73 lines (60 loc) · 2.38 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
name: Release 🚀🚀🚀
on:
# This job runs when a new release is published
release:
types: [published]
env:
CI: true
NODE_VERSION: 18
defaults:
run:
shell: bash
working-directory: ./packages/cli
jobs:
release:
name: Release to NPM
runs-on: ubuntu-latest
if: "!contains(github.event.release.tag_name , 'alpha')"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.pnpm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Install & cache node dependencies
uses: ./.github/actions/install
# Store the name of the release
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- name: Package repository
run: pnpm -w package
- name: Copy paste root README to @sls-mentor/sls-mentor
run: cp ../../README.md ./README.md
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: pnpm version $RELEASE_VERSION --no-git-tag-version && echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc && pnpm publish --access public --no-git-checks && rm .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
prerelease:
name: Release a 3.0.0-alpha version to NPM
runs-on: ubuntu-latest
if: contains(github.event.release.tag_name, 'alpha')
defaults:
run:
working-directory: ./packages/graph-cli
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.pnpm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Install & cache node dependencies
uses: ./.github/actions/install
# Store the name of the release
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- name: Package repository
run: pnpm -w package
- name: Copy paste root README to @sls-mentor/sls-mentor
run: cp ../../README.md ./README.md
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: pnpm version $RELEASE_VERSION --no-git-tag-version && echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc && pnpm publish --access public --no-git-checks --tag alpha && rm .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}