|
71 | 71 | with: |
72 | 72 | subject-path: 'dist/*' |
73 | 73 |
|
| 74 | + # Publish wasm-tools.wasm as an OCI artifact to GHCR |
| 75 | + - name: Install ORAS |
| 76 | + uses: oras-project/setup-oras@v1 |
| 77 | + if: steps.tag.outputs.push_tag == 'yes' |
| 78 | + with: |
| 79 | + version: '1.2.2' |
| 80 | + |
| 81 | + - name: Install cosign |
| 82 | + uses: sigstore/cosign-installer@v3 |
| 83 | + if: steps.tag.outputs.push_tag == 'yes' |
| 84 | + with: |
| 85 | + cosign-release: 'v2.4.1' |
| 86 | + |
| 87 | + - name: Extract wasm binary from tarball |
| 88 | + if: steps.tag.outputs.push_tag == 'yes' |
| 89 | + shell: bash |
| 90 | + run: | |
| 91 | + version=${{ steps.tag.outputs.version }} |
| 92 | + tar xzf "dist/wasm-tools-${version}-wasm32-wasip1.tar.gz" \ |
| 93 | + --strip-components=1 -C dist \ |
| 94 | + "wasm-tools-${version}-wasm32-wasip1/wasm-tools.wasm" |
| 95 | +
|
| 96 | + - name: Push wasm to GHCR |
| 97 | + if: steps.tag.outputs.push_tag == 'yes' |
| 98 | + shell: bash |
| 99 | + run: | |
| 100 | + echo "${{ github.token }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin |
| 101 | + image_ref="ghcr.io/${{ github.repository_owner }}/wasm-tools-wasm32-wasip1" |
| 102 | + version=${{ steps.tag.outputs.version }} |
| 103 | + oras push "${image_ref}:${version}" "dist/wasm-tools.wasm:application/wasm" |
| 104 | +
|
| 105 | + - name: Push latest tag to GHCR |
| 106 | + if: steps.tag.outputs.push_tag == 'yes' && github.ref == 'refs/heads/main' |
| 107 | + shell: bash |
| 108 | + run: | |
| 109 | + image_ref="ghcr.io/${{ github.repository_owner }}/wasm-tools-wasm32-wasip1" |
| 110 | + oras push "${image_ref}:latest" "dist/wasm-tools.wasm:application/wasm" |
| 111 | +
|
| 112 | + - name: Sign OCI artifact with cosign |
| 113 | + if: steps.tag.outputs.push_tag == 'yes' |
| 114 | + shell: bash |
| 115 | + run: | |
| 116 | + image_ref="ghcr.io/${{ github.repository_owner }}/wasm-tools-wasm32-wasip1" |
| 117 | + version=${{ steps.tag.outputs.version }} |
| 118 | + cosign sign --yes "${image_ref}:${version}" |
| 119 | +
|
| 120 | + - name: Sign latest tag with cosign |
| 121 | + if: steps.tag.outputs.push_tag == 'yes' && github.ref == 'refs/heads/main' |
| 122 | + shell: bash |
| 123 | + run: | |
| 124 | + image_ref="ghcr.io/${{ github.repository_owner }}/wasm-tools-wasm32-wasip1" |
| 125 | + cosign sign --yes "${image_ref}:latest" |
| 126 | +
|
74 | 127 | # Conditionally run crate publishes if the token is present. |
75 | 128 | - run: rustup update stable && rustup default stable |
76 | 129 | shell: bash |
|
0 commit comments