-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (57 loc) · 1.69 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
on:
push:
branches: [ main, ci* ]
tags: [ v* ]
pull_request:
branches: [ main ]
jobs:
get-info:
runs-on: ubuntu-latest
outputs:
commit-hash: ${{ steps.git-info.outputs.commit-hash }}
steps:
- uses: actions/checkout@v4
- name: Get git info
id: git-info
shell: bash
run: |
COMMIT_HASH=$(git rev-parse --short ${{ GITHUB.SHA }})
echo "commit-hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: get-info
env:
OUTPUT_FOLDER: 'pkg'
RELEASE_FOLDER: 'release'
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 'nightly',
target: 'wasm32-unknown-unknown'
- name: Build with wasm-pack
run: |
cargo install wasm-pack
wasm-pack build
- name: List files
run: |
ls -la
ls -la pkg
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: diff-match-patch-wasm_${{ needs.get-info.outputs.commit-hash }}_#${{ GITHUB.RUN_NUMBER }}
path: ${{ env.OUTPUT_FOLDER }}
- name: Prepare for release
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
mkdir -p ${{ env.RELEASE_FOLDER }}
7z a -tzip ${{ env.RELEASE_FOLDER }}/diff-match-patch-wasm.zip ${{ env.OUTPUT_FOLDER }}/*
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ env.RELEASE_FOLDER }}/diff-match-patch-wasm.zip