Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 2de983e

Browse files
Merge pull request #31 from GoodNotes/create-carton-release
Create carton release
2 parents 16cc21f + ac4ca6a commit 2de983e

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/release_carton.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Create Swift WASM build tools
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create-ubuntu-carton-build:
8+
name: Create Swift ${{ matrix.swift-version }} WASM build tools
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
strategy:
13+
matrix:
14+
swift-version: [5.8.0]
15+
include:
16+
- swift-version: 5.8.0
17+
carton-version: 0.19.0
18+
19+
steps:
20+
- name: Checkout the repo
21+
uses: actions/checkout@v3
22+
23+
- name: Install dependencies
24+
run: |
25+
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
26+
sudo apt-get -q update
27+
sudo apt-get -q install -y libedit2 libgcc-9-dev libpython2.7 libsqlite3-0 libstdc++-9-dev \
28+
libxml2 libz3-dev zlib1g-dev build-essential libncurses5 libxkbcommon0 curl unzip
29+
30+
- name: Install Binaryen tools
31+
run: |
32+
curl -L -v -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_113/binaryen-version_113-x86_64-linux.tar.gz
33+
tar xzvf binaryen.tar.gz
34+
mv binaryen-version_113 binaryen
35+
cp binaryen/bin/* /usr/local/bin
36+
37+
- name: Build carton
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
run: |
41+
export CARTON_DEFAULT_TOOLCHAIN=wasm-${{ matrix.swift-version }}-version
42+
gh repo clone swiftwasm/carton -- --branch ${{ matrix.carton-version }} --single-branch
43+
cd carton
44+
swift build -c release
45+
.build/release/carton --version
46+
47+
- name: Download Swift ${{ matrix.swift-version }} toolchain
48+
run: |
49+
curl -L https://github.com/swiftwasm/swift/releases/download/swift-wasm-${{ matrix.swift-version }}-RELEASE/swift-wasm-${{ matrix.swift-version }}-RELEASE-ubuntu22.04_x86_64.tar.gz -o swift-toolcahin.tar.gz
50+
tar xf swift-toolcahin.tar.gz
51+
mv swift-wasm-* wasm-${{ matrix.swift-version }}-RELEASE
52+
53+
- name: Create WASM build tools bundle
54+
id: create-build
55+
run: |
56+
wasm_tools_dir="swift-wasm-tools-${{ matrix.swift-version }}-ubuntu22.04"
57+
echo "bundle_name=$wasm_tools_dir.tar.lz4" | tee -a $GITHUB_OUTPUT
58+
mkdir -p $wasm_tools_dir
59+
mv carton/.build/release/carton $wasm_tools_dir/carton
60+
mv binaryen/bin/wasm-opt $wasm_tools_dir/wasm-opt
61+
mv wasm-${{ matrix.swift-version }}-RELEASE $wasm_tools_dir/
62+
tar cf - $wasm_tools_dir | lz4 > $wasm_tools_dir.tar.lz4
63+
64+
- name: Compute release version number
65+
id: compute-version
66+
env:
67+
GH_TOKEN: ${{ github.token }}
68+
run: |
69+
version=$(gh api -i 'repos/${{ github.repository }}/commits?sha=${{ github.sha }}&per_page=1' | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p')
70+
[ $version -ge 0 ] 2>/dev/null && : || exit 1
71+
echo "value=$version" | tee -a $GITHUB_OUTPUT
72+
73+
- name: Create Release with WASM bundle
74+
uses: ncipollo/release-action@v1
75+
with:
76+
tag: "release-${{ matrix.swift-version }}-${{ steps.compute-version.outputs.value }}"
77+
commit: ${{ github.sha }}
78+
artifacts: "${{ steps.create-build.outputs.bundle_name }}"
79+
omitBody: true

0 commit comments

Comments
 (0)