Skip to content

Commit 878c1a3

Browse files
committed
chore(template): update template
1 parent 6a4466e commit 878c1a3

10 files changed

Lines changed: 312 additions & 286 deletions

File tree

.github/workflows/commit-lint.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# ------------------------------------------------------------- #
2+
# Note: this file is automatically managed in template-template #
3+
# ------------------------------------------------------------- #
4+
5+
on: pull_request
6+
7+
name: pull_request
8+
9+
jobs:
10+
pr-screen:
11+
runs-on: ubuntu-20.04
12+
13+
# only run for external PRs
14+
if: github.event.pull_request.head.repo.full_name != github.repository
15+
16+
steps:
17+
- run: echo ::debug::pr screen complete
18+
working-directory: ${{ github.workspace }}
19+
20+
commit-lint:
21+
needs: pr-screen
22+
23+
timeout-minutes: 5
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- uses: ahmadnassri/action-commit-lint@v1
31+
with:
32+
config: .github/linters/.commit-lint.yml
33+
34+
super-linter:
35+
needs: pr-screen
36+
37+
timeout-minutes: 5
38+
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/checkout@v2
43+
with:
44+
fetch-depth: 0
45+
46+
- uses: github/super-linter@v3.15.5
47+
env:
48+
LOG_LEVEL: ERROR
49+
VALIDATE_ALL_CODEBASE: false
50+
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
51+
GITHUB_TOKEN: ${{ github.token }}
52+
53+
npm-audit:
54+
needs: pr-screen
55+
56+
timeout-minutes: 5
57+
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- uses: actions/checkout@v2
62+
63+
- uses: actions/setup-node@v2.1.5
64+
65+
- run: npm audit --audit-level=critical
66+
67+
test-strategy:
68+
needs:
69+
- commit-lint
70+
- super-linter
71+
- npm-audit
72+
73+
timeout-minutes: 5
74+
75+
runs-on: ubuntu-latest
76+
77+
outputs:
78+
matrix: ${{ steps.parse.outputs.matrix }}
79+
80+
steps:
81+
- uses: actions/checkout@v2
82+
- id: parse
83+
run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)"
84+
85+
test-run:
86+
needs: test-strategy
87+
88+
timeout-minutes: 5
89+
90+
name: ${{ matrix.name || format('node v{0} @ {1}', matrix.node-version, matrix.os) || 'test-step' }}
91+
92+
strategy:
93+
matrix: ${{ fromJSON(needs.test-strategy.outputs.matrix) }}
94+
95+
runs-on: ${{ matrix.os }}
96+
97+
steps:
98+
- uses: actions/setup-node@v2.1.5
99+
with:
100+
node-version: ${{ matrix.node-version }}
101+
102+
- uses: actions/checkout@v2
103+
with:
104+
submodules: true
105+
106+
- uses: actions/cache@v2.1.4
107+
with:
108+
path: ~/.npm
109+
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
110+
111+
- run: npm ci
112+
- run: npm run test:ci
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,34 @@
22
# Note: this file is automatically managed in template-template #
33
# ------------------------------------------------------------- #
44

5-
name: auto-merge
6-
75
on: pull_request_target
86

7+
name: pull_request_target
8+
99
jobs:
1010
auto-merge:
11+
# only run for dependabot
12+
if: github.actor == 'dependabot[bot]'
13+
1114
timeout-minutes: 5
1215

1316
runs-on: ubuntu-latest
1417

15-
if: github.actor == 'dependabot[bot]'
16-
1718
steps:
1819
- uses: actions/checkout@v2
1920
- uses: ahmadnassri/action-dependabot-auto-merge@v2.4
2021
with:
2122
github-token: ${{ secrets.GH_TOKEN }}
23+
24+
template-sync:
25+
timeout-minutes: 20
26+
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- uses: ahmadnassri/action-template-repository-sync@v1
33+
with:
34+
github-token: ${{ secrets.GH_TOKEN }}
35+
dry-run: true

.github/workflows/push.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# ------------------------------------------------------------- #
2+
# Note: this file is automatically managed in template-template #
3+
# ------------------------------------------------------------- #
4+
5+
on: push
6+
7+
name: push
8+
9+
jobs:
10+
commit-lint:
11+
timeout-minutes: 5
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- uses: ahmadnassri/action-commit-lint@v1
19+
with:
20+
config: .github/linters/.commit-lint.yml
21+
22+
super-linter:
23+
timeout-minutes: 5
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
32+
- uses: github/super-linter@v3.15.5
33+
env:
34+
LOG_LEVEL: ERROR
35+
VALIDATE_ALL_CODEBASE: false
36+
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
37+
GITHUB_TOKEN: ${{ github.token }}
38+
39+
npm-audit:
40+
timeout-minutes: 5
41+
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- uses: actions/setup-node@v2.1.5
48+
49+
- run: npm audit --audit-level=critical
50+
51+
test-strategy:
52+
needs:
53+
- commit-lint
54+
- super-linter
55+
- npm-audit
56+
57+
timeout-minutes: 5
58+
59+
runs-on: ubuntu-latest
60+
61+
outputs:
62+
matrix: ${{ steps.parse.outputs.matrix }}
63+
64+
steps:
65+
- uses: actions/checkout@v2
66+
- id: parse
67+
run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)"
68+
69+
test-run:
70+
needs: test-strategy
71+
72+
timeout-minutes: 5
73+
74+
name: ${{ matrix.name || format('node v{0} @ {1}', matrix.node-version, matrix.os) || 'test-step' }}
75+
76+
strategy:
77+
matrix: ${{ fromJSON(needs.test-strategy.outputs.matrix) }}
78+
79+
runs-on: ${{ matrix.os }}
80+
81+
steps:
82+
- uses: actions/setup-node@v2.1.5
83+
with:
84+
node-version: ${{ matrix.node-version }}
85+
86+
- uses: actions/checkout@v2
87+
with:
88+
submodules: true
89+
90+
- uses: actions/cache@v2.1.4
91+
with:
92+
path: ~/.npm
93+
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
94+
95+
- run: npm ci
96+
- run: npm run test:ci
97+
98+
release:
99+
needs: test-run
100+
101+
# only runs on main branch
102+
if: ${{ github.ref == 'refs/heads/master' }}
103+
104+
timeout-minutes: 20
105+
106+
runs-on: ubuntu-latest
107+
108+
outputs:
109+
published: ${{ steps.release.outputs.published }}
110+
version: ${{ steps.release.outputs.release-version }}
111+
112+
steps:
113+
- uses: actions/checkout@v2
114+
with:
115+
submodules: true
116+
117+
- id: release
118+
uses: ahmadnassri/action-semantic-release@v1
119+
with:
120+
config: ${{ github.workspace }}/.semantic.json
121+
env:
122+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
123+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
124+
125+
mirror:
126+
needs: release
127+
128+
timeout-minutes: 5
129+
130+
runs-on: ubuntu-latest
131+
132+
if: needs.release.outputs.published == 'true'
133+
134+
steps:
135+
- uses: actions/checkout@v2
136+
with:
137+
submodules: true
138+
139+
- uses: ahmadnassri/action-github-registry-npm-proxy@v2
140+
with:
141+
token: ${{ secrets.GH_TOKEN }}
142+
scope: ${{ github.repository_owner }}
143+
144+
- name: publish to github registry
145+
run: |
146+
jq '.name = "@'${GITHUB_REPOSITORY/node-/}'"' package.json > /tmp/package.json; mv /tmp/package.json .
147+
npm version --no-git-tag-version v${{ needs.release.outputs.version }}
148+
npm publish
149+
150+
template-sync:
151+
needs: release
152+
153+
timeout-minutes: 20
154+
155+
runs-on: ubuntu-latest
156+
157+
steps:
158+
- uses: ahmadnassri/action-workflow-queue@v1
159+
160+
- uses: actions/checkout@v2
161+
162+
- uses: ahmadnassri/action-template-repository-sync@v1
163+
with:
164+
github-token: ${{ secrets.GH_TOKEN }}
165+
dry-run: true

0 commit comments

Comments
 (0)