|
5 | 5 | tags:
|
6 | 6 | - v*
|
7 | 7 |
|
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
8 | 12 | jobs:
|
9 |
| - release-image: |
| 13 | + publish: |
10 | 14 | runs-on: ubuntu-latest
|
11 | 15 | steps:
|
12 |
| - - uses: actions/checkout@v3 |
13 |
| - - uses: docker/setup-buildx-action@v2 |
14 |
| - - uses: actions/setup-node@v2 |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - uses: actions/setup-node@v4 |
15 | 18 | with:
|
16 |
| - node-version: '16' |
17 |
| - registry-url: 'https://registry.npmjs.org' |
18 |
| - - run: npm install |
19 |
| - - run: cd ./packages/pyright-scip/ && npm install && npm run build |
20 |
| - - run: cd ./packages/pyright-scip/ && npm publish --access public |
| 19 | + cache: npm |
| 20 | + cache-dependency-path: '**/package-lock.json' |
| 21 | + node-version: 16 |
| 22 | + registry-url: https://registry.npmjs.org |
| 23 | + |
| 24 | + - run: npm ci |
| 25 | + - run: npm ci && npm run build |
| 26 | + working-directory: ./packages/pyright-scip/ |
| 27 | + |
| 28 | + - if: ${{ env.NODE_AUTH_TOKEN }} |
| 29 | + run: npm publish --access public |
| 30 | + working-directory: ./packages/pyright-scip/ |
21 | 31 | env:
|
22 |
| - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
23 |
| - - name: Login to DockerHub |
24 |
| - uses: docker/login-action@v2 |
| 32 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 33 | + |
| 34 | + docker: |
| 35 | + needs: publish |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + version_debian: [bookworm] |
| 40 | + version_python: ['3.10'] |
| 41 | + version_node: ['16'] |
| 42 | + |
| 43 | + runs-on: ubuntu-latest |
| 44 | + permissions: |
| 45 | + contents: read |
| 46 | + packages: write |
| 47 | + attestations: write |
| 48 | + id-token: write |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: docker/login-action@v3 |
25 | 52 | with:
|
26 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
27 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
28 |
| - - name: Build and push |
29 |
| - id: docker_build_autoindex |
30 |
| - uses: docker/build-push-action@v4 |
| 53 | + registry: ${{ vars.REGISTRY || 'docker.io' }} |
| 54 | + username: ${{ secrets.DOCKER_USERNAME || github.actor }} |
| 55 | + password: ${{ secrets.DOCKER_PASSWORD || secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + # We build over more platforms and hence need QEMU and more control! |
| 58 | + - uses: docker/setup-qemu-action@v3 |
| 59 | + - uses: docker/setup-buildx-action@v3 |
| 60 | + |
| 61 | + - name: Generate image tags |
| 62 | + id: meta |
| 63 | + uses: docker/metadata-action@v5 |
31 | 64 | with:
|
32 |
| - file: Dockerfile.autoindex |
33 |
| - push: true |
| 65 | + # list of Docker images to use as base name for tags |
| 66 | + images: ${{ vars.REGISTRY || 'docker.io' }}/${{ github.repository }} |
| 67 | + flavor: | |
| 68 | + latest=true |
34 | 69 | tags: |
|
35 |
| - sourcegraph/scip-python:autoindex |
36 |
| - sourcegraph/scip-python:latest |
37 |
| - sourcegraph/scip-python:${{ github.ref_name }} |
| 70 | + type=schedule |
| 71 | + type=ref,event=tag |
| 72 | + type=sha, |
| 73 | + type=raw,value=autoindex |
| 74 | + type=semver,pattern={{version}} |
| 75 | + type=semver,pattern={{major}}.{{minor}} |
| 76 | + type=semver,pattern={{major}} |
| 77 | +
|
| 78 | + - name: Build and release image |
| 79 | + id: push |
| 80 | + uses: docker/build-push-action@v5 |
| 81 | + with: |
| 82 | + cache-from: type=gha,scope=docker-${{ matrix.version_debian}}-${{ matrix.version_python}}-${{ matrix.version_node }} |
| 83 | + cache-to: type=gha,mode=max,scope=docker-${{ matrix.version_debian}}-${{ matrix.version_python}}-${{ matrix.version_node }} |
| 84 | + push: true |
| 85 | + tags: ${{ steps.meta.outputs.tags }} |
| 86 | + labels: ${{ steps.meta.outputs.labels }} |
| 87 | + platforms: linux/amd64,linux/arm64 |
| 88 | + build-args: |- |
| 89 | + VERSION_DEBIAN=${{ matrix.version_debian }} |
| 90 | + VERSION_PYTHON=${{ matrix.version_python }} |
| 91 | + VERSION_NODE=${{ matrix.version_node }} |
| 92 | + VERSION_SCIP_PYTHON=${{ github.ref_name }} |
| 93 | +
|
| 94 | + - name: Generate artifact attestation |
| 95 | + uses: actions/attest-build-provenance@v1 |
| 96 | + with: |
| 97 | + subject-name: ${{ vars.REGISTRY || 'docker.io' }}/${{ github.repository }} |
| 98 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 99 | + push-to-registry: true |
0 commit comments