Skip to content

Commit af20b5b

Browse files
committed
chore(CI): add pre-release on tag - uploads wasm files as assets
1 parent 6b17d9e commit af20b5b

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/rust-host.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,25 @@ name: rust-host
22
on: [push, pull_request]
33

44
jobs:
5+
pre_job:
6+
# continue-on-error: true # Uncomment once integration is finished
7+
runs-on: ubuntu-latest
8+
# Map a step output to a job output
9+
outputs:
10+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
11+
steps:
12+
- id: skip_check
13+
uses: fkirc/skip-duplicate-actions@v5
14+
with:
15+
# All of these options are optional, so you can remove them if you are happy with the defaults
16+
# Skip a workflow run if the same workflow is already running
17+
concurrent_skipping: 'same_content_newer'
18+
skip_after_successful_duplicate: 'true'
19+
paths_ignore: '["**/README.md"]'
20+
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
521
build-and-test:
22+
needs: pre_job
23+
if: needs.pre_job.outputs.should_skip != 'true'
624
runs-on: ubuntu-latest
725
steps:
826
- name: Set variables based on OS and architecture for just dl-wasi-sdk
@@ -43,3 +61,35 @@ jobs:
4361
run: just test
4462
- name: Test with wasm from http server (if it fails, you need to publish a new version of pluginlab)
4563
run: just test-e2e-pluginlab-http
64+
65+
- name: Build plugins in release mode (for pre-release)
66+
if: github.ref_type == 'tag'
67+
run: just build-plugins-release
68+
- name: Prepare wasm files (for pre-release)
69+
if: github.ref_type == 'tag'
70+
run: ./scripts/prepare-wasm-files.sh --mode release --target-dir ./tmp/plugins
71+
- name: Cache wasm files (for pre-release)
72+
if: github.ref_type == 'tag'
73+
id: cache-wasm-files
74+
uses: actions/cache@v4
75+
with:
76+
path: ./tmp/plugins
77+
key: ${{ runner.os }}-wasm-files-${{ github.sha }}
78+
79+
pre-release:
80+
if: github.ref_type == 'tag'
81+
permissions:
82+
contents: write
83+
runs-on: ubuntu-latest
84+
needs: build-and-test
85+
steps:
86+
- name: Restore cached wasm files
87+
id: cache-wasm-files-restore
88+
uses: actions/cache/restore@v4
89+
with:
90+
path: ./tmp/plugins
91+
key: ${{ runner.os }}-wasm-files-${{ github.sha }}
92+
- name: Pre-release
93+
uses: softprops/action-gh-release@v2
94+
with:
95+
files: ./tmp/plugins/*.wasm

0 commit comments

Comments
 (0)