-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (165 loc) · 5.74 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
187
188
189
190
191
192
193
194
195
196
197
198
name: Release
on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# TODO(danielo) - Fix windows build
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Fetch git tags
run: git fetch --tags --force
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Set macOS deployment target
if: matrix.os == 'macos-latest'
run: |
echo "::set-env name=MACOSX_DEPLOYMENT_TARGET=10.9"
- name: Cache esy dependencies
uses: actions/cache@v1
id: cache
with:
path: _export
key: ${{ runner.OS }}-build-${{ hashFiles('esy.lock/index.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Install esy
run: npm install -g esy@latest
- name: Import dependencies
if: steps.cache.outputs.cache-hit == 'true'
run: esy import-build _export/*
- name: Install dependencies
run: esy install
- name: Build
run: esy build --release
- name: Substitute watermarks
run: esy dune subst
- name: Build subst changes
run: esy dune build
# - name: Run tests
# run: esy test
- name: Export dependencies
run: esy export-dependencies
- name: Get binary path
id: get_binary_path
if: false
shell: bash
run: |
# from https://stackoverflow.com/a/24848739/617787
s=$(pwd); d=$(dirname $(esy x which reason-ls));
while [ "${d#$s/}" == "${d}" ]
do s=$(dirname $s);b="../${b}"; done;
BINARY_PATH=${b}${d#$s/}/reason-ls
echo "BINARY_PATH: $BINARY_PATH"
echo "##[set-output name=path;]$BINARY_PATH"
- name: Another way to get binary path
shell: bash
run: |
echo "binary_path=$(esy x which reason-ls)" >> $GITHUB_ENV
- name: Upload artifacts for ${{ matrix.os }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
# path: ${{ steps.get_binary_path.outputs.path }}
path: ${{ env.binary_path }}
publish:
needs: build
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch git tags
run: git fetch --tags --force
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Make NPM release skeleton
run: node script/release-make-skeleton.js
- name: Download linux artifacts
uses: actions/download-artifact@master
with:
name: ubuntu-latest
path: _release/platform-linux-x64
- name: Download macOS artifacts
uses: actions/download-artifact@master
with:
name: macos-latest
path: _release/platform-darwin-x64
# - name: Download windows artifacts
# uses: actions/download-artifact@master
# with:
# name: windows-latest
# path: _release/platform-windows-x64
- name: Create archives for Github release
run: |
cd _release/platform-darwin-x64
zip -r ../../reason-ls-darwin-x64.zip .
cd ../..
cd _release/platform-linux-x64
zip -r ../../reason-ls-linux-x64.zip .
cd ../..
# cd _release/platform-windows-x64
# zip -r ../../reason-ls-windows-x64.zip .
# cd ../..
- name: Compute the release tag
run: |
echo "release_tag=v`date '+%Y-%m-%d'`" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
if: github.event.release.upload_url == ''
with:
tag_name: ${{ env.release_tag }}
files: |
reason-ls-darwin-x64.zip
reason-ls-linux-x64.zip
- name: Upload reason-ls-darwin-x64.zip to Github release
uses: actions/upload-release-asset@v1.0.1
if: github.event.release.upload_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: reason-ls-darwin-x64.zip
asset_name: reason-ls-darwin-x64.zip
asset_content_type: application/gzip
- name: Upload reason-ls-linux-x64.zip to Github release
uses: actions/upload-release-asset@v1.0.1
if: github.event.release.upload_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: reason-ls-linux-x64.zip
asset_name: reason-ls-linux-x64.zip
asset_content_type: application/gzip
# - name: Upload spin-windows-x64.zip to Github release
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: spin-windows-x64.zip
# asset_name: spin-windows-x64.zip
# asset_content_type: application/gzip
- name: Publish NPM package
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@{{ npm_username }}"
npm config list
npm publish --access public
working-directory: ./_release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}