-
Notifications
You must be signed in to change notification settings - Fork 13
118 lines (114 loc) · 3.68 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
name: Publish CLI
on: push
env:
CI: true
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
jobs:
build_run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: rm -r node_modules
- run: npm ci --omit=dev
- run: ./bin/run --version
- run: rm -r node_modules/@oclif/plugin-warn-if-update-available/lib/hooks/ # Remove plugin-warn-if-update-available hook from showing warning
- run: | # Check if stderr is not empty and hard error (captures node warnings)
error=$(./bin/run --version 2>&1 >/dev/null)
[ ! -z "$error" ] && echo "$error" && exit 1 || echo "No error"
# Start webpack test for mangling/compressing
- run: npm ci
working-directory: ./test/webpack
- run: npm run webpack
working-directory: ./test/webpack
- run: node ./lib/main.js
working-directory: ./test/webpack
# End webpack test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run check-circular
test:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
publish_cli:
name: Publish CLI
if: github.ref_name == 'main' || github.ref_name == 'rc' || startsWith(github.ref_name, 'arc-')
needs: [build_run, lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
clean: true
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run readme
- run: npm run generate:schema-docs
- run: npm run generate:yarn-lock
- name: npm publish
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ~/.npmrc
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) npm run semantic-release
publish_docs:
name: Publish Docs
if: github.ref_name == 'main'
needs: [publish_cli]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
clean: true
path: architect-cli
ref: main
- uses: actions/checkout@v3
with:
repository: architect-team/documentation
token: ${{ secrets.DOCS_GITHUB_TOKEN }}
clean: true
path: documentation
ref: main
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: node ./architect-cli/bin/readme-mdx.mjs ./documentation/reference/cli.mdx
- run: cp ./architect-cli/architect-yml.md ./documentation/reference/architect-yml.mdx
- run: cp ./architect-cli/CHANGELOG.md ./documentation/reference/changelog.mdx
- name: Commit
working-directory: ./documentation
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add -A
git diff-index --quiet HEAD || git commit -m "Update auto-generated files from CLI"
git push