-
Notifications
You must be signed in to change notification settings - Fork 3
128 lines (124 loc) · 3.9 KB
/
publish.yml
File metadata and controls
128 lines (124 loc) · 3.9 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
name: Publish packages to npm
on:
push:
branches:
- master
jobs:
build-platform:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
# Steps needed for esy
- uses: actions/setup-node@v1
with:
node-version: 12
- uses: actions/checkout@v1
- name: Install esy
run: npm install -g esy
# Install and build
- name: Try to restore install cache
uses: actions/cache@v1
with:
path: ~/.esy/source
key: source-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
# restore keys are not used for install sources because esy cleanup does not remove those.
# Therefore the esy/source directory would grow infinitely
- name: Install dependencies
run: esy install
- name: Print esy cache
id: print_esy_cache
run: node .github/workflows/print_esy_cache.js
- name: Try to restore dependencies cache
id: deps-cache
uses: actions/cache@v1
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
restore-keys: build-${{ matrix.os }}-
- name: Build
run: esy build
# Create the NPM package for this platform
- name: Create npm package
run: esy npm-release
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: _release/
prepare-publish:
name: Prepare publish to npm
needs: build-platform
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v1
with:
fetch-depth: 1
ref: ${{ github.ref }}
submodules: true
# Download platform artifacts
- name: Download Linux release
uses: actions/download-artifact@v1
with:
name: ubuntu-latest
- name: Download Windows release
uses: actions/download-artifact@v1
with:
name: windows-latest
- name: Download macOS release
uses: actions/download-artifact@v1
with:
name: macOS-latest
# Move artifacts in place
- name: Move artifacts
run: |
mkdir -p _release/platform-linux
mkdir -p _release/platform-windows-x64
mkdir -p _release/platform-darwin
cp -a ubuntu-latest/. _release/platform-linux
cp -a windows-latest/. _release/platform-windows-x64
cp -a macOS-latest/. _release/platform-darwin
- name: Prepare package
run: node .github/workflows/bundle-release.js
# Create a npm package that can easily be published and tested
- name: npm pack
run: npm pack .
working-directory: _release
- name: move package
run: mv _release/*.tgz redemon.tgz
# Upload artifacts
- uses: actions/upload-artifact@v2
with:
name: release
path: _release/
- uses: actions/upload-artifact@v2
with:
name: release-tarball
path: redemon.tgz
#- name: Publish packages
# run: node .github/workflows/publish_to_npm.js
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
test-platform:
name: Test installing ${{ matrix.os }}
needs: prepare-publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Download Linux release
uses: actions/download-artifact@v1
with:
name: release-tarball
- name: test install
run: npm -g install ./release-tarball/redemon.tgz
- name: test binary
run: npx redemon --help