|
| 1 | +name: Publish Kernel Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v** |
| 7 | + workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI |
| 8 | + |
| 9 | +env: |
| 10 | + REGISTRY: ghcr.io |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-push-image: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + attestations: write |
| 19 | + id-token: write |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + - name: Log in to the Container registry |
| 24 | + uses: docker/login-action@v3.3.0 |
| 25 | + with: |
| 26 | + registry: ${{ env.REGISTRY }} |
| 27 | + username: ${{ github.actor }} |
| 28 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - name: Extract base image metadata |
| 30 | + id: meta-base |
| 31 | + uses: docker/metadata-action@v5.6.1 |
| 32 | + with: |
| 33 | + images: ${{ env.REGISTRY }}/ipython-kernel |
| 34 | + # semver has default priority 900, sha has default priority 100 |
| 35 | + # ref has default priority 600 |
| 36 | + # see <https://github.com/docker/metadata-action#priority-attribute> |
| 37 | + # also, sha has a default prefix of '-sha' |
| 38 | + # see <https://github.com/docker/metadata-action#typesha> |
| 39 | + tags: | |
| 40 | + type=semver,pattern={{version}} |
| 41 | + type=sha,priority=850,prefix= |
| 42 | + - name: Build and push base image |
| 43 | + id: push-base |
| 44 | + uses: docker/build-push-action@v6.10.0 |
| 45 | + with: |
| 46 | + file: images/base/Dockerfile |
| 47 | + context: images/base |
| 48 | + push: true |
| 49 | + tags: ${{ steps.meta-base.outputs.tags }} |
| 50 | + labels: ${{ steps.meta-base.outputs.labels }} |
| 51 | + - name: Generate base artifact attestation |
| 52 | + uses: actions/attest-build-provenance@v1 |
| 53 | + with: |
| 54 | + subject-name: ${{ env.REGISTRY }}/ipython-kernel |
| 55 | + subject-digest: ${{ steps.push-base.outputs.digest }} |
| 56 | + push-to-registry: true |
| 57 | + - name: Extract scipy image metadata |
| 58 | + id: meta-scipy |
| 59 | + uses: docker/metadata-action@v5.6.1 |
| 60 | + with: |
| 61 | + images: ${{ env.REGISTRY }}/scipy-kernel |
| 62 | + # semver has default priority 900, sha has default priority 100 |
| 63 | + # ref has default priority 600 |
| 64 | + # see <https://github.com/docker/metadata-action#priority-attribute> |
| 65 | + # also, sha has a default prefix of '-sha' |
| 66 | + # see <https://github.com/docker/metadata-action#typesha> |
| 67 | + tags: | |
| 68 | + type=semver,pattern={{version}} |
| 69 | + type=sha,priority=850,prefix= |
| 70 | + - name: Build and push scipy image |
| 71 | + id: push-scipy |
| 72 | + uses: docker/build-push-action@v6.10.0 |
| 73 | + with: |
| 74 | + file: images/scipy/Dockerfile |
| 75 | + context: images/scipy |
| 76 | + push: true |
| 77 | + tags: ${{ steps.meta-scipy.outputs.tags }} |
| 78 | + labels: ${{ steps.meta-scipy.outputs.labels }} |
| 79 | + - name: Generate scipy artifact attestation |
| 80 | + uses: actions/attest-build-provenance@v1 |
| 81 | + with: |
| 82 | + subject-name: ${{ env.REGISTRY }}/scipy-kernel |
| 83 | + subject-digest: ${{ steps.push-scipy.outputs.digest }} |
| 84 | + push-to-registry: true |
| 85 | + - name: Extract scipy-zh-cn image metadata |
| 86 | + id: meta-scipy-zh-cn |
| 87 | + uses: docker/metadata-action@v5.6.1 |
| 88 | + with: |
| 89 | + images: ${{ env.REGISTRY }}/scipy-kernel |
| 90 | + # semver has default priority 900, sha has default priority 100 |
| 91 | + # ref has default priority 600 |
| 92 | + # see <https://github.com/docker/metadata-action#priority-attribute> |
| 93 | + # also, sha has a default prefix of '-sha' |
| 94 | + # see <https://github.com/docker/metadata-action#typesha> |
| 95 | + tags: | |
| 96 | + type=semver,pattern={{version}} |
| 97 | + type=sha,priority=850,prefix=,suffix=-zh-cn |
| 98 | + - name: Build and push scipy-zh-cn image |
| 99 | + id: push-scipy-zh-cn |
| 100 | + uses: docker/build-push-action@v6.10.0 |
| 101 | + with: |
| 102 | + file: images/scipy-zh-cn/Dockerfile |
| 103 | + context: images/scipy-zh-cn |
| 104 | + push: true |
| 105 | + tags: ${{ steps.meta-scipy-zh-cn.outputs.tags }} |
| 106 | + labels: ${{ steps.meta-scipy-zh-cn.outputs.labels }} |
| 107 | + - name: Generate scipy-zh-cn artifact attestation |
| 108 | + uses: actions/attest-build-provenance@v1 |
| 109 | + with: |
| 110 | + subject-name: ${{ env.REGISTRY }}/scipy-kernel |
| 111 | + subject-digest: ${{ steps.push-scipy-zh-cn.outputs.digest }} |
| 112 | + push-to-registry: true |
0 commit comments