Merge pull request #16 from wodby/feature/image-revisions #756
Workflow file for this run
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: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '*' | |
| - '!*-r[0-9]*' | |
| pull_request: | |
| env: | |
| PYTHON314: '3.14.7' | |
| PYTHON313: '3.13.15' | |
| PYTHON312: '3.12.14' | |
| PYTHON311: '3.11.16' | |
| PYTHON310: '3.10.21' | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| python-versions: ${{ steps.set-matrix.outputs.python-versions }} | |
| steps: | |
| - id: set-matrix | |
| run: | | |
| cat << 'EOF' > versions.json | |
| [ | |
| {"key": "python314", "version": "${{ env.PYTHON314 }}", "latest": "latest", "latest_major": "3"}, | |
| {"key": "python313", "version": "${{ env.PYTHON313 }}", "latest": "", "latest_major": ""}, | |
| {"key": "python312", "version": "${{ env.PYTHON312 }}", "latest": "", "latest_major": ""}, | |
| {"key": "python311", "version": "${{ env.PYTHON311 }}", "latest": "", "latest_major": ""}, | |
| {"key": "python310", "version": "${{ env.PYTHON310 }}", "latest": "", "latest_major": ""} | |
| ] | |
| EOF | |
| echo "python-versions=$(cat versions.json | jq -c .)" >> $GITHUB_OUTPUT | |
| build: | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ${{ fromJson(needs.setup.outputs.python-versions) }} | |
| arch: | |
| - amd64 | |
| - arm64 | |
| dev: | |
| - '' | |
| - 'dev' | |
| user_id: | |
| - 1000 | |
| - 501 | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| - user_id: 501 | |
| group_id: 20 | |
| dev: dev | |
| exclude: | |
| - dev: '' | |
| user_id: 501 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build and test | |
| id: build-image | |
| env: | |
| PYTHON_VER: ${{ matrix.python.version }} | |
| ARCH: ${{ matrix.arch }} | |
| PYTHON_DEV: ${{ matrix.dev }} | |
| WODBY_USER_ID: ${{ matrix.user_id }} | |
| WODBY_GROUP_ID: ${{ matrix.group_id }} | |
| run: | | |
| make | |
| make test | |
| echo "image=$(make --no-print-directory -s image-ref)" >> "$GITHUB_OUTPUT" | |
| - name: Scan image | |
| uses: ./.github/actions/grype | |
| with: | |
| image: docker:${{ steps.build-image.outputs.image }} | |
| - uses: docker/login-action@v3 | |
| if: github.event_name == 'push' | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push architecture image | |
| if: github.event_name == 'push' | |
| env: | |
| PYTHON_VER: ${{ matrix.python.version }} | |
| ARCH: ${{ matrix.arch }} | |
| PYTHON_DEV: ${{ matrix.dev }} | |
| WODBY_USER_ID: ${{ matrix.user_id }} | |
| WODBY_GROUP_ID: ${{ matrix.group_id }} | |
| run: make push | |
| push: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - setup | |
| - build | |
| strategy: | |
| matrix: | |
| python: ${{ fromJson(needs.setup.outputs.python-versions) }} | |
| dev: | |
| - '' | |
| - 'dev' | |
| user_id: | |
| - 1000 | |
| - 501 | |
| exclude: | |
| - dev: '' | |
| user_id: 501 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: docker/login-action@v3 | |
| if: github.event_name == 'push' | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - uses: ./.github/actions | |
| with: | |
| version: ${{ matrix.python.version }} | |
| dev: ${{ matrix.dev }} | |
| user_id: ${{ matrix.user_id }} | |
| latest: ${{ matrix.python.latest }} | |
| latest_major: ${{ matrix.python.latest_major }} | |
| image-revision-aliases: | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/r') | |
| needs: [ push ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: image-revision-aliases-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: wodby/images/.github/actions/image-revision-aliases@6a3956567002e48847338be97b4d955ee40ae7cb | |
| with: | |
| docker_username: ${{ secrets.DOCKER_USERNAME }} | |
| docker_password: ${{ secrets.DOCKER_PASSWORD }} |