|
| 1 | +name: docker-3.3dev |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 3.3dev |
| 7 | + workflow_dispatch: |
| 8 | + # Every day at 7am on Mondays, publish the 3.3dev branch. |
| 9 | + # NOTE: `schedule` event is only triggered for the default branch: |
| 10 | + # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule |
| 11 | + schedule: |
| 12 | + - cron: "0 7 * * *" |
| 13 | + |
| 14 | +env: |
| 15 | + GIT_BRANCH: "3.3dev" |
| 16 | + |
| 17 | +jobs: |
| 18 | + deploy: |
| 19 | + runs-on: ubuntu-24.04 |
| 20 | + steps: |
| 21 | + - name: lowercase the repository name |
| 22 | + run: echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}" |
| 23 | + |
| 24 | + - name: Source checkout |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup QEMU |
| 28 | + id: qemu |
| 29 | + uses: docker/setup-qemu-action@v3 |
| 30 | + |
| 31 | + - name: Setup Buildx |
| 32 | + id: buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + |
| 35 | + - name: Set Docker metadata |
| 36 | + id: docker_meta |
| 37 | + uses: docker/metadata-action@v5 |
| 38 | + with: |
| 39 | + images: ${{ env.REPO }} |
| 40 | + labels: | |
| 41 | + org.opencontainers.image.version=${{ env.GIT_BRANCH }} |
| 42 | + org.opencontainers.image.revision=${{ github.sha }} |
| 43 | + org.opencontainers.image.title=${{ env.REPO }} |
| 44 | +
|
| 45 | + - name: GitHub login |
| 46 | + if: ${{ github.event_name != 'pull_request' }} |
| 47 | + uses: docker/login-action@v3 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.repository_owner }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + |
| 53 | + - name: Build and push |
| 54 | + uses: docker/build-push-action@v6 |
| 55 | + with: |
| 56 | + push: ${{ github.event_name != 'pull_request' }} |
| 57 | + context: . |
| 58 | + file: Dockerfile.alpine |
| 59 | + platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le |
| 60 | + cache-from: type=gha, scope=${{ github.workflow }} |
| 61 | + cache-to: type=gha, scope=${{ github.workflow }} |
| 62 | + labels: ${{ steps.docker_meta.outputs.labels }} |
| 63 | + tags: | |
| 64 | + ghcr.io/${{ env.REPO }}:${{ env.GIT_BRANCH }} |
| 65 | + ghcr.io/${{ env.REPO }}:latest |
0 commit comments