-
Notifications
You must be signed in to change notification settings - Fork 200
106 lines (86 loc) · 3.33 KB
/
continuous-deployment.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
name: Continuous Deployment
on:
push:
branches:
- main
jobs:
release-canary:
runs-on: aries-ubuntu-2004
name: Release Canary
if: "!startsWith(github.event.head_commit.message, 'chore(release): v')"
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
with:
# pulls all commits (needed for lerna to correctly version)
fetch-depth: 0
# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile
# On push to main, release unstable version
- name: Release Unstable
run: |
export NEXT_VERSION_BUMP=$(./node_modules/.bin/ts-node ./scripts/get-next-bump.ts)
yarn lerna publish --loglevel=verbose --canary $NEXT_VERSION_BUMP --exact --force-publish --yes --no-verify-access --dist-tag alpha
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get version number
id: get-version
run: |
LAST_RELEASED_VERSION=$(npm view @aries-framework/core@alpha version)
echo "::set-output name=version::$LAST_RELEASED_VERSION"
- name: Setup git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set git tag
run: |
git tag v${{ steps.get-version.outputs.version }}
git push origin v${{ steps.get-version.outputs.version }} --no-verify
release-stable:
runs-on: aries-ubuntu-2004
name: Create Stable Release
# Only run if the last pushed commit is a release commit
if: "startsWith(github.event.head_commit.message, 'chore(release): v')"
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Get updated version
id: new-version
run: |
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo $NEW_VERSION
echo "::set-output name=version::$NEW_VERSION"
- name: Create Tag
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.new-version.outputs.version }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.new-version.outputs.version }}
body: |
Release v${{ steps.new-version.outputs.version }}
You can find the changelog in the [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) file.
- name: Release to NPM
run: yarn lerna publish from-package --loglevel=verbose --yes --no-verify-access
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}