This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.7 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
name: Publish
on:
push:
branches:
- 'main'
paths-ignore:
- '**.md'
jobs:
publish-npm:
if: "!contains(github.event.head_commit.author.name, 'GITHUBACTION')
&& (
startsWith(github.event.head_commit.message, 'BREAKING CHANGE:')
|| startsWith(github.event.head_commit.message, 'feat')
|| startsWith(github.event.head_commit.message, 'fix')
)"
runs-on: ubuntu-latest
steps:
- run: echo "$DATA"
env:
DATA: ${{ toJson(github.event.head_commit) }}
- uses: actions/checkout@v2-beta
with:
token: ${{ secrets.GH_TOKEN_ACTION }}
# Workaround for https://github.com/actions/checkout/issues/6#issuecomment-520636057
- name: Prepare repository
run: git checkout "${GITHUB_REF:11}"
- name: Configure Git
run: |
git remote rm origin
git remote add origin "https://$USER_NAME:[email protected]/boostercloud/rocket-auth-aws-infrastructure.git"
git fetch
git config --local user.email "[email protected]"
git config --local user.name "GITHUBACTION"
env:
USER_NAME: ${{ secrets.DEPLOYING_USER_NAME }}
GITHUB_PAT: ${{ secrets.GH_TOKEN_ACTION }} # Token for pushing
- uses: actions/setup-node@main
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.BOT_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.BOT_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: npm install
- run: npm run compile
- run: npm install @boostercloud/[email protected] --global
# Discard all changes that might have occurred after bootstrap
- run: git stash
- name: Authenticate with Registry
run: npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Running integration tests before release
env:
AWS_ACCESS_KEY_ID: ${{ secrets.BOT_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOT_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
run: npm run integration --stream
- name: Discard all the changes after integration tests
run: git stash
- name: Semantic Release
uses: cycjimmy/semantic-release-action@master
id: semantic
with:
extra_plugins: |
@semantic-release/git
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ACTION }}