Skip to content

Commit 3b5a150

Browse files
authored
Merge pull request spinframework#49 from karthik2804/ci/add_release
add checksum, plugin package and release action
2 parents a94f6f0 + c237bb2 commit 3b5a150

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

.github/workflows/build.yaml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ jobs:
6161
default: true
6262
target: ${{ matrix.config.target }}
6363

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+
6479
- name: "Install Wasm Rust target"
6580
shell: bash
6681
run: rustup target add wasm32-wasi
@@ -112,9 +127,62 @@ jobs:
112127
echo $WASI_SDK
113128
make BUILD_TARGET=${{ matrix.config.buildArgs }}
114129
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 }}
115138
116139
- name: Upload build artifact
117140
uses: actions/upload-artifact@v3
118141
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

Comments
 (0)