-
Notifications
You must be signed in to change notification settings - Fork 4
186 lines (161 loc) · 5.44 KB
/
publish.yaml
File metadata and controls
186 lines (161 loc) · 5.44 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Publish
on: workflow_dispatch
permissions:
contents: write
concurrency:
group: publish-${{ github.ref }}
env:
WORKSPACE_ARCHIVE: workspace.tar
WORKSPACE_ARTIFACT: build-results
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: "package.json"
cache: "yarn"
- name: Yarn install
run: yarn install --immutable
- name: Yarn build
run: yarn build
- name: Tar files
run: tar --exclude='.git' --exclude=${{ env.WORKSPACE_ARCHIVE }} -cvf ${{ env.WORKSPACE_ARCHIVE }} .
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.WORKSPACE_ARTIFACT }}
path: ${{ env.WORKSPACE_ARCHIVE }}
retention-days: 1
test-vcvarsall-invocation:
name: Test Developer Command Prompt Setup (${{ matrix.arch }}) - ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
arch: [x64, x32, x86_arm, x86_arm64]
steps:
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.WORKSPACE_ARTIFACT }}
path: .
- name: Untar
run: |
tar -xvf ${{ env.WORKSPACE_ARCHIVE }}
rm ${{ env.WORKSPACE_ARCHIVE }}
- name: setup-msvc-dev
uses: ./
with:
arch: ${{ matrix.arch }}
- name: 'Verify cl.exe'
shell: cmd
run: |
where cl.exe
IF ERRORLEVEL 1 exit ERRORLEVEL
test-path-exports:
name: Test exporting tool paths - ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
steps:
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.WORKSPACE_ARTIFACT }}
path: .
- name: Untar
run: |
tar -xvf ${{ env.WORKSPACE_ARCHIVE }}
rm ${{ env.WORKSPACE_ARCHIVE }}
- name: setup-msvc-dev
uses: ./
with:
export-path-to-vcvarsall: PATH_TO_VCVARSALL
export-path-to-vs: PATH_TO_VS
- name: 'Verify path to vcvarsall.bat'
shell: cmd
run: IF NOT EXIST "%PATH_TO_VCVARSALL%\vcvarsall.bat" exit 1
- name: 'Verify path to VS'
shell: cmd
run: IF NOT EXIST "%PATH_TO_VS%" exit 1
publish:
name: Publish
needs: ["build", "test-vcvarsall-invocation", "test-path-exports"]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.WORKSPACE_ARTIFACT }}
path: .
- name: Untar
run: |
tar -xvf ${{ env.WORKSPACE_ARCHIVE }}
rm ${{ env.WORKSPACE_ARCHIVE }}
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: "package.json"
cache: "yarn"
- run: |
VERSION=`npm pkg get version`
VERSION=`sed -e 's/^"//' -e 's/"$//' <<<"$VERSION"`
echo RELEASE_VERSION=$VERSION >> $GITHUB_ENV
echo "RELEASE_VERSION_MAJOR=v${VERSION%%.*}" >> $GITHUB_ENV
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
ref: ${{ env.RELEASE_VERSION_MAJOR }}
path: "release"
id: checkoutrelease
continue-on-error: true
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: steps.checkoutrelease.outcome != 'success'
with:
path: "release"
- name: Commit and push release
run: |
pushd .
cd release
git restore --source=origin/master -SW .
cp -a ../dist/. dist
git add -f dist/**
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git commit -m "Release $RELEASE_VERSION"
git tag v$RELEASE_VERSION
git push -u origin HEAD:$RELEASE_VERSION_MAJOR --tags
popd
# So, what's happening here?
#
# Basically, restoring the workspace state between jobs is incredibly annoying.
# We can get reasonable support by using the upload-/download-artifact
# actions, but they suffer from a severe limitation:
# GH Actions has a storage limit and the minimum retention is 24 hours...
#
# Since the storage quota is limited, we have to make sure that the artifact
# is removed. Unfortunately, there is no official way to do this, so we resort
# to a third party action for now.
#
# See also: https://github.com/actions/upload-artifact/issues/290
cleanup:
name: Cleanup
if: ${{ always() }}
needs: publish
runs-on: ubuntu-latest
steps:
- name: Cleanup
uses: GeekyEggo/delete-artifact@176a747ab7e287e3ff4787bf8a148716375ca118 # v6.0.0
with:
name: ${{ env.workspace_artifact }}