docker #40
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: docker | |
| "on": | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - latest/* | |
| - .github/workflows/docker.yml | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - latest/* | |
| - .github/workflows/docker.yml | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 8 * * 1 | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| id: source | |
| uses: actions/checkout@v5 | |
| - name: Detect version | |
| id: version | |
| run: | | |
| VER=$(sed -ne "s/^.*COMMITLINT_CLI_VERSION=\(.*\)/\1/p;" latest/Dockerfile) | |
| echo IMAGE_TAG=${VER} >> ${GITHUB_ENV} | |
| echo "Building ${VER}" | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| flavor: | | |
| latest=true | |
| tags: | | |
| type=raw,value=${{ env.IMAGE_TAG }} | |
| type=schedule,pattern={{date 'YYYYMMDD'}} | |
| type=ref,enable=true,event=branch | |
| labels: | | |
| org.opencontainers.image.vendor=Cloudpunks | |
| maintainer=Cloudpunks GmbH <ops@cloudpunks.de> | |
| - name: Setup QEMU | |
| id: qemu | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Ghcr login | |
| id: login3 | |
| uses: docker/login-action@v3 | |
| if: github.event_name != 'pull_request' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker build | |
| id: docker | |
| uses: docker/build-push-action@v6 | |
| with: | |
| builder: ${{ steps.buildx.outputs.name }} | |
| context: latest/ | |
| file: latest/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| ... |