-
Notifications
You must be signed in to change notification settings - Fork 6
77 lines (69 loc) · 2.19 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
release-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- run: go version
- name: 'Build cli'
run: yarn build:cli:upx
- uses: actions/github-script@v6
with:
script: |
const fs = require('fs').promises;
const { owner, repo } = context.repo;
const tagName = context.ref.split('/')[2];
console.log(`Creating release for ${owner} in ${repo} at ${tagName}`);
const release = await github.rest.repos.createRelease({
owner,
repo,
tag_name: tagName,
generate_release_notes: true,
draft: true,
});
for (const file of await fs.readdir('./dist/cli')) {
console.log(`Adding asset ${file}`);
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./dist/cli/${file}`),
});
}
release-library:
runs-on: ubuntu-latest
needs: release-cli
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile --non-interactive
- name: 'Build library'
run: yarn build:lib
- name: 'Publish: Determine npm tag'
id: npm_tag
run: |
if [[ "$REF" == *"-"* ]]
then
echo "npm_tag=next" >> $GITHUB_OUTPUT
else
echo "npm_tag=latest" >> $GITHUB_OUTPUT
fi
env:
REF: ${{ github.ref }}
- name: 'Publish: angular-server-side-configuration'
run: yarn publish dist/angular-server-side-configuration --tag ${{ steps.npm_tag.outputs.npm_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}