|
61 | 61 | default: true |
62 | 62 | target: ${{ matrix.config.target }} |
63 | 63 |
|
| 64 | + - name: set the release version (main) |
| 65 | + shell: bash |
| 66 | + run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV |
| 67 | + |
| 68 | + - name: set the release version (tag) |
| 69 | + if: startsWith(github.ref, 'refs/tags/v') |
| 70 | + shell: bash |
| 71 | + run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 72 | + |
| 73 | + - name: lowercase the runner OS name |
| 74 | + shell: bash |
| 75 | + run: | |
| 76 | + OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') |
| 77 | + echo "RUNNER_OS=$OS" >> $GITHUB_ENV |
| 78 | +
|
64 | 79 | - name: "Install Wasm Rust target" |
65 | 80 | shell: bash |
66 | 81 | run: rustup target add wasm32-wasi |
@@ -112,9 +127,62 @@ jobs: |
112 | 127 | echo $WASI_SDK |
113 | 128 | make BUILD_TARGET=${{ matrix.config.buildArgs }} |
114 | 129 |
|
| 130 | + - name: Package as plugins tar |
| 131 | + shell: bash |
| 132 | + run: | |
| 133 | + mkdir -v _dist |
| 134 | + cp ${{ matrix.config.targetDir }}/spinjs${{ matrix.config.extension }} _dist/js2wasm${{ matrix.config.extension }} |
| 135 | + cp LICENSE _dist/js2wasm.license |
| 136 | + cd _dist |
| 137 | + tar czf js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz js2wasm.license js2wasm${{ matrix.config.extension }} |
115 | 138 |
|
116 | 139 | - name: Upload build artifact |
117 | 140 | uses: actions/upload-artifact@v3 |
118 | 141 | with: |
119 | | - name: spinjs-${{ runner.os }}-${{ matrix.config.arch }} |
120 | | - path: ${{ matrix.config.targetDir }}/spinjs${{ matrix.config.extension }} |
| 142 | + name: js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz |
| 143 | + path: _dist/js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz |
| 144 | + |
| 145 | + - name: upload binary to Github release |
| 146 | + if: startsWith(github.ref, 'refs/tags/v') |
| 147 | + uses: svenstaro/upload-release-action@v2 |
| 148 | + with: |
| 149 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 150 | + file: _dist/js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz |
| 151 | + tag: ${{ github.ref }} |
| 152 | + |
| 153 | + checksums: |
| 154 | + name: generate checksums |
| 155 | + runs-on: ubuntu-latest |
| 156 | + needs: build |
| 157 | + steps: |
| 158 | + - name: set the release version (main) |
| 159 | + shell: bash |
| 160 | + run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV |
| 161 | + |
| 162 | + - name: set the release version (tag) |
| 163 | + if: startsWith(github.ref, 'refs/tags/v') |
| 164 | + shell: bash |
| 165 | + run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 166 | + |
| 167 | + - name: download release assets |
| 168 | + uses: actions/download-artifact@v3 |
| 169 | + |
| 170 | + - name: generate checksums |
| 171 | + run: | |
| 172 | + ls -lh |
| 173 | + sha256sum js2wasm*.tar.gz/js2wasm*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt |
| 174 | +
|
| 175 | + - uses: actions/upload-artifact@v3 |
| 176 | + with: |
| 177 | + name: checksums-${{ env.RELEASE_VERSION }}.txt |
| 178 | + path: checksums-${{ env.RELEASE_VERSION }}.txt |
| 179 | + |
| 180 | + - name: upload checksums to Github release |
| 181 | + if: startsWith(github.ref, 'refs/tags/v') |
| 182 | + uses: svenstaro/upload-release-action@v2 |
| 183 | + with: |
| 184 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 185 | + file: checksums-${{ env.RELEASE_VERSION }}.txt |
| 186 | + tag: ${{ github.ref }} |
| 187 | + |
| 188 | + |
0 commit comments