Build Docker Image #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Docker Image | |
| on: | |
| schedule: | |
| # Refresh monthly to pick up base image updates | |
| # Base image refreshed on the 26th, so run on the 28nd to capture upstream changes. | |
| - cron: '0 0 28 * *' | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: anothrNick/github-tag-action@1.71.0 | |
| id: bump_version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
| DEFAULT_BUMP: patch | |
| WITH_V: true | |
| - uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/metadata-action@v5 | |
| id: docker_meta | |
| with: | |
| images: | | |
| devdull/${{ github.event.repository.name }} | |
| tags: | | |
| # Tag branches with branch name, but disable for default branch | |
| type=ref,event=branch,enable=${{ github.ref_name != 'main' }} | |
| # set latest tag for default branch | |
| type=raw,value=latest,enable=${{ github.ref_name == 'main' }} | |
| # Always tag with the current version number | |
| type=raw,value=${{ steps.bump_version.outputs.new_tag }},enable=${{ github.ref_name == 'main' }} | |
| - uses: docker/build-push-action@v5 | |
| id: docker_build | |
| with: | |
| platforms: linux/amd64,linux/arm,linux/arm64 | |
| push: ${{ github.repository_owner == 'dev-dull' }} | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.REPO_TOKEN }} | |
| tag_name: ${{ steps.bump_version.outputs.new_tag }} | |
| generate_release_notes: true | |
| files: '*' |