|
| 1 | +name: dstack-ingress Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'dstack-ingress-v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + packages: write |
| 11 | + attestations: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-attest: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + env: |
| 18 | + IMAGE_REGISTRY: docker.io |
| 19 | + IMAGE_REPOSITORY: ${{ vars.DOCKERHUB_ORG }}/dstack-ingress |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Parse version from tag |
| 25 | + run: | |
| 26 | + VERSION=${GITHUB_REF#refs/tags/dstack-ingress-v} |
| 27 | + if [ -z "${VERSION}" ]; then |
| 28 | + echo "Unable to parse version from ref: ${GITHUB_REF}" >&2 |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | + echo "VERSION=${VERSION}" >> "$GITHUB_ENV" |
| 32 | + echo "IMAGE_REFERENCE=${IMAGE_REGISTRY}/${IMAGE_REPOSITORY}:${VERSION}" >> "$GITHUB_ENV" |
| 33 | + echo "Parsed version: ${VERSION}" |
| 34 | +
|
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + sudo apt-get update |
| 38 | + sudo apt-get install -y skopeo jq |
| 39 | +
|
| 40 | + - name: Log in to Docker registry |
| 41 | + uses: docker/login-action@v3 |
| 42 | + with: |
| 43 | + registry: ${{ env.IMAGE_REGISTRY }} |
| 44 | + username: ${{ vars.DOCKERHUB_USERNAME }} |
| 45 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Build reproducible image and push |
| 48 | + working-directory: custom-domain/dstack-ingress |
| 49 | + env: |
| 50 | + IMAGE_REFERENCE: ${{ env.IMAGE_REFERENCE }} |
| 51 | + run: | |
| 52 | + ./build-image.sh --push "${IMAGE_REFERENCE}" |
| 53 | +
|
| 54 | + - name: Capture image digest |
| 55 | + id: capture-digest |
| 56 | + working-directory: custom-domain/dstack-ingress |
| 57 | + run: | |
| 58 | + DIGEST=$(skopeo inspect oci-archive:./oci.tar | jq -r '.Digest') |
| 59 | + if [ -z "${DIGEST}" ]; then |
| 60 | + echo "Failed to determine image digest" >&2 |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | + echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + - name: Generate artifact attestation |
| 66 | + uses: actions/attest-build-provenance@v1 |
| 67 | + with: |
| 68 | + subject-name: docker.io/${{ env.IMAGE_REPOSITORY }} |
| 69 | + subject-digest: ${{ steps.capture-digest.outputs.digest }} |
| 70 | + push-to-registry: true |
| 71 | + |
| 72 | + - name: Publish summary |
| 73 | + env: |
| 74 | + IMAGE_REFERENCE: ${{ env.IMAGE_REFERENCE }} |
| 75 | + IMAGE_DIGEST: ${{ steps.capture-digest.outputs.digest }} |
| 76 | + run: | |
| 77 | + { |
| 78 | + echo "## dstack-ingress image" |
| 79 | + echo "" |
| 80 | + echo "- Tag: \`${IMAGE_REFERENCE}\`" |
| 81 | + echo "- Digest: \`${IMAGE_DIGEST}\`" |
| 82 | + echo "- Sigstore: https://search.sigstore.dev/?hash=${IMAGE_DIGEST}" |
| 83 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments