# vim: ts=2 sw=2: name: Docker Build and Deploy on: workflow_dispatch: pull_request: branches: - master push: # Publish `master` as Docker `dev` image. branches: - master # Publish `v*` tags as x.x.x images and as `latest`. tags: - v* concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: docker: name: Build and push docker images runs-on: ubuntu-latest permissions: packages: write steps: - name: Checkout uses: classabbyamp/treeless-checkout-action@v1 - name: Write ref to file if: ${{ github.event_name != 'pull_request' }} run: git rev-list -n 1 $GITHUB_REF > ./git_commit - name: Docker metadata id: meta uses: docker/metadata-action@v4 with: images: | ghcr.io/${{ github.repository }} tags: | type=sha,prefix= type=raw,value=dev,enable={{is_default_branch}} type=raw,event=tag,value=latest,enable={{is_default_branch}} type=ref,event=tag,prefix=,enable={{is_default_branch}},priority=1000 flavor: latest=false labels: | org.opencontainers.image.authors=classabbyamp and 0x5c org.opencontainers.image.url=https://github.com/miaowware/qrm2 org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.vendor=miaowware org.opencontainers.image.title=qrm2 org.opencontainers.image.description=Discord bot with ham radio functions - name: Login to Github Container Registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}