-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (152 loc) · 5.78 KB
/
release.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
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: Release
on:
schedule:
- cron: "0 0 * * *" # midnight UTC
workflow_dispatch:
push:
branches:
- release
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
build_server:
strategy:
matrix:
include:
# - os: ubuntu-latest
# code-target: linux-x64
- os: ubuntu-latest
code-target: no-server
# - os: macos-14
# code-target: darwin-arm64
# - os: macos-12
# code-target: darwin-x64
name: dist (${{ matrix.code-target }})
runs-on: ${{ matrix.os }}
steps:
- name: Set patch version
run: |
if [[ $GITHUB_REF == 'refs/heads/release' ]]; then
echo "version=0.1" >> $GITHUB_ENV
else
echo "version=0.2" >> $GITHUB_ENV
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# - name: Use OCaml
# with:
# ocaml-compiler: 4.14.0
# dune-cache: true
# cache-prefix: v1-${{ matrix.os }}
# allow-prerelease-opam: true
# uses: ocaml/setup-ocaml@v3
# # - run: |
# # opam install . --deps-only
# # - run: LINKING_MODE=static opam exec -- dune build --profile=release
- run: npm ci
working-directory: vscode
# - name: Copy server to bundle
# run: |
# cp _build/default/bin/main.exe ide/creusot-ide
# cp -R _opam/lib/why3 ide/why-lib
# cp -R _opam/share/why3 ide/why-data
# if: matrix.code_target != 'no-server'
- run: mkdir dist
- run: cp README.md vscode/
- name: Set Version Number
run: |
echo "Preparing version: ${{env.version}}.${{github.run_number}}"
node -e "var p = require('./package.json'); console.log(JSON.stringify({...p, version: '${{ env.version }}.${{ github.run_number }}' }))" > ./package.nightly.json
mv package.nightly.json package.json
working-directory: vscode
- name: Package
run: npx vsce package -o "../dist/creusot-ide-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
if: github.ref == 'refs/heads/release' && matrix.code-target != 'no-server'
working-directory: vscode
- name: Package (Nightly)
run: npx vsce package -o "../dist/creusot-ide-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
if: github.ref != 'refs/heads/release' && matrix.code-target != 'no-server'
working-directory: vscode
# Publish fallback
- if: matrix.code-target == 'no-server' && github.ref == 'refs/heads/release'
run: npx vsce package -o ../dist/creusot-ide-no-server.vsix
working-directory: vscode
- if: matrix.code-target == 'no-server' && github.ref != 'refs/heads/release'
run: npx vsce package -o ../dist/creusot-ide-no-server.vsix --pre-release
working-directory: vscode
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.code-target }}
path: ./dist
publish:
needs: [build_server,check_date]
runs-on: ubuntu-latest
steps:
- name: Install Nodejs
uses: actions/setup-node@v4
with:
node-version: 20
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
# - uses: actions/download-artifact@v4
# with:
# name: darwin-arm64
# path: dist
# - uses: actions/download-artifact@v4
# with:
# name: darwin-x64
# path: dist
- uses: actions/download-artifact@v4
with:
name: no-server
path: dist
# - uses: actions/download-artifact@v4
# with:
# name: linux-x64
# path: dist
- run: ls -al ./dist
- run: npm ci
working-directory: ./vscode
- name: Publish Extension (Code Marketplace, nightly)
if: github.ref != 'refs/heads/release' && needs.check_date.outputs.should_run != 'true'
working-directory: ./vscode
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../dist/creusot-ide-*.vsix
# TODO(xavier): Get token on OpenVSX
# - name: Publish Extension (OpenVSX, nightly)
# if: github.ref != 'refs/heads/release' && needs.check_date.outputs.should_run != 'true'
# working-directory: ./ide
# run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../dist/creusot-ide-*.vsix
# timeout-minutes: 2
- name: Publish Extension (Code Marketplace)
if: github.ref == 'refs/heads/release'
working-directory: ./vscode
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../dist/creusot-ide-*.vsix
# - name: Publish Extension (OpenVSX)
# if: github.ref == 'refs/heads/release'
# working-directory: ./ide
# run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../dist/creusot-ide-*.vsix
# timeout-minutes: 2
# - name: Release
# - name: Release
# uses: softprops/action-gh-release@v1