|
| 1 | +name: KMS Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'kms-v*' |
| 8 | +permissions: |
| 9 | + attestations: write |
| 10 | + id-token: write |
| 11 | + contents: write |
| 12 | + packages: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-release: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Parse version from tag |
| 22 | + run: | |
| 23 | + # Extract version from tag (e.g., kms-v1.2.3 -> 1.2.3) |
| 24 | + VERSION=${GITHUB_REF#refs/tags/kms-v} |
| 25 | + echo "VERSION=$VERSION" >> $GITHUB_ENV |
| 26 | + echo "Parsed version: $VERSION" |
| 27 | +
|
| 28 | + - name: Log in to Docker Hub |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + username: ${{ vars.DOCKERHUB_USERNAME }} |
| 32 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Set up Docker Buildx |
| 35 | + uses: docker/setup-buildx-action@v3 |
| 36 | + |
| 37 | + - name: Write GIT_REV |
| 38 | + run: git rev-parse HEAD > kms/dstack-app/builder/.GIT_REV |
| 39 | + |
| 40 | + - name: Get Git commit timestamps |
| 41 | + run: | |
| 42 | + echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV |
| 43 | + echo "GIT_REV=$(git rev-parse HEAD)" >> $GITHUB_ENV |
| 44 | +
|
| 45 | + - name: Build and push Docker image |
| 46 | + id: build-and-push |
| 47 | + uses: docker/build-push-action@v5 |
| 48 | + env: |
| 49 | + SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} |
| 50 | + with: |
| 51 | + context: kms/dstack-app/builder |
| 52 | + push: true |
| 53 | + tags: ${{ vars.DOCKERHUB_USERNAME }}/kms:${{ env.VERSION }} |
| 54 | + platforms: linux/amd64 |
| 55 | + provenance: false |
| 56 | + build-args: | |
| 57 | + DSTACK_REV=${{ env.GIT_REV }} |
| 58 | + DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }} |
| 59 | + SOURCE_DATE_EPOCH=${{ env.TIMESTAMP }} |
| 60 | +
|
| 61 | + - name: Generate artifact attestation |
| 62 | + uses: actions/attest-build-provenance@v1 |
| 63 | + with: |
| 64 | + subject-name: "docker.io/${{ vars.DOCKERHUB_USERNAME }}/kms" |
| 65 | + subject-digest: ${{ steps.build-and-push.outputs.digest }} |
| 66 | + push-to-registry: true |
| 67 | + |
| 68 | + - name: Setup Node.js |
| 69 | + uses: actions/setup-node@v4 |
| 70 | + with: |
| 71 | + node-version: '18' |
| 72 | + cache: 'npm' |
| 73 | + cache-dependency-path: kms/auth-eth/package-lock.json |
| 74 | + |
| 75 | + - name: Install dependencies and compile contracts |
| 76 | + run: | |
| 77 | + cd kms/auth-eth |
| 78 | + npm ci |
| 79 | + npx hardhat compile |
| 80 | +
|
| 81 | + - name: GitHub Release |
| 82 | + uses: softprops/action-gh-release@v1 |
| 83 | + with: |
| 84 | + name: "KMS Release v${{ env.VERSION }}" |
| 85 | + files: | |
| 86 | + kms/auth-eth/artifacts/contracts/DstackKms.sol/DstackKms.json |
| 87 | + kms/auth-eth/artifacts/contracts/DstackApp.sol/DstackApp.json |
| 88 | + body: | |
| 89 | + ## Docker Image Information |
| 90 | +
|
| 91 | + **Image**: `docker.io/${{ vars.DOCKERHUB_USERNAME }}/kms:${{ env.VERSION }}` |
| 92 | +
|
| 93 | + **Digest (SHA256)**: `${{ steps.build-and-push.outputs.digest }}` |
| 94 | +
|
| 95 | + **Verification**: [Verify on Sigstore](https://search.sigstore.dev/?hash=${{ steps.build-and-push.outputs.digest }}) |
| 96 | +
|
| 97 | + ## Contract ABIs |
| 98 | +
|
| 99 | + This release includes the compiled contract ABIs: |
| 100 | + - `DstackKms.json` - Main KMS contract ABI |
| 101 | + - `DstackApp.json` - Application contract ABI |
0 commit comments