|
| 1 | +name: Build Docker Image |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + # Refresh monthly to pick up base image updates |
| 5 | + # Base image refreshes on the 1st, so run on the 2nd to capture upstream changes. |
| 6 | + - cron: '0 0 2 * *' |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - uses: anothrNick/github-tag-action@1.71.0 |
| 17 | + id: bump_version |
| 18 | + env: |
| 19 | + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} |
| 20 | + DEFAULT_BUMP: patch |
| 21 | + WITH_V: true |
| 22 | + |
| 23 | + - uses: docker/login-action@v3 |
| 24 | + with: |
| 25 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 26 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 27 | + |
| 28 | + - uses: docker/setup-qemu-action@v3 |
| 29 | + |
| 30 | + - uses: docker/setup-buildx-action@v3 |
| 31 | + |
| 32 | + - uses: docker/metadata-action@v5 |
| 33 | + id: docker_meta |
| 34 | + with: |
| 35 | + images: | |
| 36 | + devdull/${{ github.event.repository.name }} |
| 37 | + tags: | |
| 38 | + # Tag branches with branch name, but disable for default branch |
| 39 | + type=ref,event=branch,enable=${{ github.ref_name != 'main' }} |
| 40 | + # set latest tag for default branch |
| 41 | + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} |
| 42 | + # Always tag with the current version number |
| 43 | + type=raw,value=${{ steps.bump_version.outputs.new_tag }},enable=${{ github.ref_name == 'main' }} |
| 44 | +
|
| 45 | + - uses: docker/build-push-action@v5 |
| 46 | + id: docker_build |
| 47 | + with: |
| 48 | + platforms: linux/amd64,linux/arm,linux/arm64 |
| 49 | + push: ${{ github.repository_owner == 'dev-dull' }} |
| 50 | + tags: ${{ steps.docker_meta.outputs.tags }} |
| 51 | + labels: ${{ steps.docker_meta.outputs.labels }} |
0 commit comments