Files
FOSSBilling/.github/workflows/release-docker.yml
T

70 lines
2.1 KiB
YAML

name: Upload Release to Docker Hub
on:
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-dockerhub
cancel-in-progress: false
jobs:
# Latest release is identified by branch/tag SemVer,
# not the 'Set as the latest release' GitHub option.
check-latest:
name: 'Check if Release is Latest'
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
is_latest: ${{ steps.compare-latest.outputs.is_latest }}
steps:
- name: 'Get Latest Release Version Tag'
id: get-latest
uses: pozetroninc/github-action-get-latest-release@53d33d213ee71c72360e3c829caf7cee94ec21e2 # master
with:
excludes: 'prerelease,draft'
repository: 'FOSSBilling/FOSSBilling'
token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Check if Current Release Version is Latest'
id: compare-latest
run: |
if [ "${{ github.ref_name }}" = "${{ steps.get-latest.outputs.release }}" ]; then
echo "is_latest=true" >> "${GITHUB_OUTPUT}"
else
echo "is_latest=false" >> "${GITHUB_OUTPUT}"
fi
deploy-release-docker:
name: 'Build and Push Release to Docker Hub'
permissions:
contents: read
id-token: write
needs: [ check-latest ]
uses: docker/github-builder/.github/workflows/build.yml@c2782c55efa56a01b9c30021db8f5ec3993228a3 # v1.8.0
secrets:
registry-auths: |
- registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
with:
output: image
push: true
platforms: linux/amd64,linux/arm64
cache: false
sbom: true
set-meta-labels: true
set-meta-annotations: true
meta-images: fossbilling/fossbilling
meta-flavor: |
latest=false
meta-tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ needs.check-latest.outputs.is_latest == 'true' }}
build-args: |
FOSSBILLING_VERSION=${{ github.ref_name }}
SENTRY_DSN=${{ vars.SENTRY_DSN }}