|
| 1 | +name: trusted-workload-launcher Release |
| 2 | +on: |
| 3 | + workflow_dispatch: {} |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'trusted-workload-launcher-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 }}/trusted-workload-launcher |
| 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/trusted-workload-launcher-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: Run launcher tests |
| 36 | + working-directory: trusted-workload-launcher |
| 37 | + run: ./tests/run-tests.sh |
| 38 | + |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@v3 |
| 41 | + |
| 42 | + - name: Log in to Docker registry |
| 43 | + uses: docker/login-action@v3 |
| 44 | + with: |
| 45 | + registry: ${{ env.IMAGE_REGISTRY }} |
| 46 | + username: ${{ vars.DOCKERHUB_USERNAME }} |
| 47 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 48 | + |
| 49 | + - name: Build and push Docker image |
| 50 | + id: build-and-push |
| 51 | + uses: docker/build-push-action@v5 |
| 52 | + with: |
| 53 | + context: trusted-workload-launcher |
| 54 | + file: trusted-workload-launcher/docker/Dockerfile |
| 55 | + push: true |
| 56 | + tags: docker.io/${{ vars.DOCKERHUB_ORG }}/trusted-workload-launcher:${{ env.VERSION }} |
| 57 | + platforms: linux/amd64 |
| 58 | + labels: | |
| 59 | + org.opencontainers.image.title=trusted-workload-launcher |
| 60 | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} |
| 61 | + org.opencontainers.image.revision=${{ github.sha }} |
| 62 | + org.opencontainers.image.version=${{ env.VERSION }} |
| 63 | +
|
| 64 | + - name: Generate artifact attestation |
| 65 | + uses: actions/attest-build-provenance@v1 |
| 66 | + with: |
| 67 | + subject-name: docker.io/${{ vars.DOCKERHUB_ORG }}/trusted-workload-launcher |
| 68 | + subject-digest: ${{ steps.build-and-push.outputs.digest }} |
| 69 | + push-to-registry: true |
| 70 | + |
| 71 | + - name: Publish summary |
| 72 | + env: |
| 73 | + IMAGE_REFERENCE: ${{ env.IMAGE_REFERENCE }} |
| 74 | + IMAGE_DIGEST: ${{ steps.build-and-push.outputs.digest }} |
| 75 | + run: | |
| 76 | + { |
| 77 | + echo "## trusted-workload-launcher image" |
| 78 | + echo "" |
| 79 | + echo "- Tag: \`${IMAGE_REFERENCE}\`" |
| 80 | + echo "- Digest: \`${IMAGE_DIGEST}\`" |
| 81 | + echo "- Sigstore: https://search.sigstore.dev/?hash=${IMAGE_DIGEST}" |
| 82 | + } >> "$GITHUB_STEP_SUMMARY" |
| 83 | +
|
| 84 | + - name: Release |
| 85 | + uses: softprops/action-gh-release@v1 |
| 86 | + with: |
| 87 | + body: | |
| 88 | + ## trusted-workload-launcher image (SHA256) |
| 89 | +
|
| 90 | + - Image: `${{ env.IMAGE_REFERENCE }}` |
| 91 | + - Digest: `${{ steps.build-and-push.outputs.digest }}` |
| 92 | + - Verification: https://search.sigstore.dev/?hash=${{ steps.build-and-push.outputs.digest }} |
0 commit comments