-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (194 loc) · 5.8 KB
/
publish.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
199
200
201
name: publish
env:
NODE_VERSION: 18.x
NPM_REGISTRY: 'https://registry.npmjs.org'
on:
push:
tags:
- v*
- DRYRUN*
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
action: ${{ steps.action.outputs.type }}
steps:
- name: Get Tag Name
uses: olegtarasov/[email protected]
id: tagName
- id: action
name: Determine Action Type
shell: bash
run: |
if [[ ${{ contains(steps.tagName.outputs.tag, 'DRYRUN') }} == true ]]
then
echo type=dryrun
echo "type=dryrun" >> "$GITHUB_OUTPUT"
else
echo type=publish
echo "type=publish" >> "$GITHUB_OUTPUT"
fi
macos-builds:
name: Builds (macOS)
needs: [setup]
strategy:
matrix:
target: [darwin-arm64, darwin-x64]
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: npm ci
- name: Bump Version (dry-run only)
if: ${{ needs.setup.outputs.action == 'dryrun' }}
shell: bash
run: |
git checkout main
git config --global user.email '[email protected]'
git config --global user.name 'Neon CI'
git branch -a
npm version patch -m 'dryrun'
git branch -a
git status
- name: Build
uses: neon-actions/[email protected]
with:
working-directory: ./pkgs/cargo-messages
input-directory: npm/${{ matrix.target }}
node-version: ${{ env.NODE_VERSION }}
npm-publish: false
github-release: ${{ needs.setup.outputs.action == 'publish' }}
windows-builds:
name: Builds (Windows)
needs: [setup]
strategy:
matrix:
target: [win32-x64-msvc, win32-arm64-msvc]
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: npm ci
- name: Bump Version (dry-run only)
if: ${{ needs.setup.outputs.action == 'dryrun' }}
shell: bash
run: |
git checkout main
git config --global user.email '[email protected]'
git config --global user.name 'Neon CI'
git branch -a
npm version patch -m 'dryrun'
git branch -a
git status
- name: Build
uses: neon-actions/[email protected]
with:
working-directory: ./pkgs/cargo-messages
input-directory: npm/${{ matrix.target }}
node-version: ${{ env.NODE_VERSION }}
npm-publish: false
github-release: ${{ needs.setup.outputs.action == 'publish' }}
other-builds:
name: Builds (other platforms)
needs: [setup]
strategy:
matrix:
target: [linux-arm-gnueabihf, linux-x64-gnu, android-arm-eabi]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: npm ci
- name: Bump Version (dry-run only)
if: ${{ needs.setup.outputs.action == 'dryrun' }}
shell: bash
run: |
git checkout main
git config --global user.email '[email protected]'
git config --global user.name 'Neon CI'
git branch -a
npm version patch -m 'dryrun'
git branch -a
git status
- name: Build
uses: neon-actions/[email protected]
with:
working-directory: ./pkgs/cargo-messages
input-directory: npm/${{ matrix.target }}
node-version: ${{ env.NODE_VERSION }}
use-cross: true
target: ${{ matrix.target }}
npm-publish: false
github-release: ${{ needs.setup.outputs.action == 'publish' }}
publish:
name: Publish
needs: [setup, macos-builds, windows-builds, other-builds]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
shell: bash
run: npm ci
- name: Publish (cargo-messages)
if: ${{ needs.setup.outputs.action == 'publish' }}
uses: neon-actions/[email protected]
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
working-directory: ./pkgs/cargo-messages
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.NPM_REGISTRY }}
fetch-binaries: "*.tgz"
github-release: true
- name: Build (@neon-rs/load)
shell: bash
run: npm run build
working-directory: ./pkgs/load
- name: Publish (@neon-rs/load)
if: ${{ needs.setup.outputs.action == 'publish' }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
working-directory: ./pkgs/load
- name: Update (@neon-rs/cli)
if: ${{ needs.setup.outputs.action == 'publish' }}
shell: bash
run: |
git checkout main
git config --global user.email '[email protected]'
git config --global user.name 'Neon CI'
npm run update-src
git commit -a -m 'update cli to cargo-messages@latest'
git push
- name: Publish (@neon-rs/cli)
if: ${{ needs.setup.outputs.action == 'publish' }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
working-directory: ./pkgs/cli