Skip to content

Commit 8299247

Browse files
committed
chore(ci): upload built artifect if release
1 parent e4cbe89 commit 8299247

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ on:
1010
- '.github/workflows/ci.yml'
1111
pull_request:
1212
workflow_dispatch:
13+
release:
14+
types: [published]
1315
env:
1416
nim-version: '2.2.8'
17+
build_exe_cmd: 'nimble build --warning[Spacing]:off'
18+
permissions:
19+
contents: write
1520
jobs:
1621
ci:
17-
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
os: ${{ fromJSON(github.event_name == 'release' && '["ubuntu-latest","windows-latest","macos-15-intel"]' || '["ubuntu-latest"]') }}
25+
runs-on: ${{ matrix.os }}
1826
steps:
1927
- uses: actions/checkout@v4
2028
- name: Cache nimble
@@ -28,23 +36,53 @@ jobs:
2836
nim-version: ${{ env.nim-version }}
2937

3038
- name: BuildC
31-
run: nimble build --warning[Spacing]:off
39+
run: ${{ env.build_exe_cmd }}
3240
- name: Test C backend
41+
if: &linux-only runner.os == 'Linux'
3342
run: nimble test
3443

3544
- name: BuildJs
45+
if: *linux-only
3646
run: nimble buildJs -d:nodejs --warning[Spacing]:off
3747
- name: Test NodeJS backend
48+
if: *linux-only
3849
run: nimble testNodeJs
3950

4051
- name: BuildJsLib
52+
if: *linux-only
4153
run: nimble buildJsLib --warning[Spacing]:off
4254
- name: Test es6 backend
55+
if: *linux-only
4356
run: nimble testJsLib
4457

4558
- name: setup wasi sdk
59+
if: *linux-only
4660
uses: konsumer/install-wasi-sdk@v1
4761
- name: BuildWasm
62+
if: *linux-only
4863
run: |
4964
nimble install https://github.com/nimpylib/wasm_backend
5065
nimble buildWasm --warning[Spacing]:off
66+
67+
- name: Stage release assets
68+
if: &release-only github.event_name == 'release'
69+
shell: bash
70+
run: |
71+
mkdir release-assets
72+
extension=
73+
if [[ "$RUNNER_OS" == Windows ]]; then
74+
extension=.exe
75+
fi
76+
mv "bin/npython$extension" \
77+
"release-assets/npython-$RUNNER_OS-$RUNNER_ARCH$extension"
78+
if [[ "$RUNNER_OS" == Linux ]]; then
79+
mv bin/* release-assets/
80+
fi
81+
- name: Upload release assets
82+
if: *release-only
83+
shell: bash
84+
env:
85+
GH_TOKEN: ${{ github.token }}
86+
run: >-
87+
gh release upload "${{ github.event.release.tag_name }}"
88+
release-assets/* --clobber

0 commit comments

Comments
 (0)