Repository navigation
156 lines (133 loc) · 4.47 KB
/
Copy pathrelease.yml
File metadata and controls
156 lines (133 loc) · 4.47 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Release
on:
push:
branches:
- master
paths:
- "packages/core/package.json"
workflow_dispatch:
concurrency:
group: release-wasm-image-optimization
cancel-in-progress: false
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.check.outputs.should_release }}
version: ${{ steps.check.outputs.version }}
tag: ${{ steps.check.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Check package version and git tag
id: check
run: |
VERSION=$(node -p "require('./packages/core/package.json').version")
TAG="v$VERSION"
echo "Package version: $VERSION"
echo "Target tag: $TAG"
EXISTS=$(git ls-remote --tags origin "refs/tags/$TAG")
if [ -n "$EXISTS" ]; then
echo "Tag $TAG already exists on remote. Skipping release."
echo "should_release=false" >> "$GITHUB_OUTPUT"
else
echo "Tag $TAG does not exist on remote. Proceeding with release."
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
fi
release:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
env:
VCPKG_ROOT: /usr/local/share/vcpkg
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Cache vcpkg binaries
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'triplets/**') }}-${{ github.run_id }}
restore-keys: |
vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'triplets/**') }}-
vcpkg-${{ runner.os }}-
- name: Install Ninja & ccache
run: |
sudo apt-get update
sudo apt-get install -y ninja-build ccache
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-wasm
- name: Cache Emscripten
uses: actions/cache@v4
with:
path: emsdk-cache
key: ${{ runner.os }}-emsdk-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-emsdk-
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: latest
actions-cache-folder: "emsdk-cache"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Cache Skia Source
uses: actions/cache@v4
with:
path: external/skia
key: skia-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
skia-
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Wasm Configure
run: pnpm wasm:configure
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Wasm Build
run: pnpm wasm:build
- name: ccache stats
run: ccache -s
- name: Build TS Packages
run: pnpm run build:js
- name: Create and push git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "${{ needs.check-version.outputs.tag }}"
git push origin "${{ needs.check-version.outputs.tag }}"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ needs.check-version.outputs.tag }}" \
--title "${{ needs.check-version.outputs.tag }}" \
--generate-notes
- name: Publish to npm (Trusted Publishing / OIDC)
run: |
npm install -g npm@latest
pnpm --filter wasm-image-optimization publish --provenance --access public --no-git-checks