Skip to content

Commit 5629df2

Browse files
authored
chore: add new github actions (#658)
* chore: add new github actions * add condition for release * update to gh_token because master is protected
1 parent 1b06568 commit 5629df2

File tree

6 files changed

+202
-111
lines changed

6 files changed

+202
-111
lines changed

.github/workflows/ci.yml

-57
This file was deleted.

.github/workflows/development.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Development workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '+([0-9])?(.{+([0-9]),x}).x'
7+
- main
8+
- master
9+
- alpha
10+
- beta
11+
- next
12+
- next-major
13+
types: [opened, synchronize, reopened]
14+
15+
jobs:
16+
build:
17+
# ignore all-contributors PRs
18+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
node: [14, 15]
23+
os: [ubuntu-latest, macOS-latest, windows-latest]
24+
25+
steps:
26+
- name: 🛑 Cancel Previous Runs
27+
uses: styfle/[email protected]
28+
with:
29+
access_token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: ⬇️ Checkout
32+
uses: actions/checkout@v2
33+
34+
- name: ⎔ Setup node ${{ matrix.node }}
35+
uses: actions/setup-node@v1
36+
with:
37+
node-version: ${{ matrix.node }}
38+
39+
- name: 📥 Download deps
40+
uses: bahmutov/npm-install@v1
41+
with:
42+
useLockFile: false
43+
env:
44+
HUSKY_SKIP_INSTALL: true
45+
46+
- name: 🧪 Run lint
47+
run: npm run lint
48+
49+
- name: 🏗 Build
50+
run: npm run build
51+
env:
52+
CI: true
53+
54+
- name: Run coverage
55+
run: npm run test:coverage
56+
57+
- name: Upload coverage to Codecov
58+
uses: codecov/codecov-action@v1
59+
with:
60+
file: ./coverage/lcov.info

.github/workflows/production.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Production workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- alpha
9+
- beta
10+
- next
11+
- next-major
12+
- '!all-contributors/**'
13+
14+
jobs:
15+
build:
16+
# ignore all-contributors PRs
17+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
node: [14, 15]
22+
os: [ubuntu-latest, macOS-latest, windows-latest]
23+
24+
steps:
25+
- name: 🛑 Cancel Previous Runs
26+
uses: styfle/[email protected]
27+
with:
28+
access_token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: ⬇️ Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: ⎔ Setup node ${{ matrix.node }}
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: ${{ matrix.node }}
37+
38+
- name: 📥 Download deps
39+
uses: bahmutov/npm-install@v1
40+
with:
41+
useLockFile: false
42+
env:
43+
HUSKY_SKIP_INSTALL: true
44+
45+
- name: 🧪 Run lint
46+
run: npm run lint
47+
48+
- name: 🏗 Build
49+
run: npm run build
50+
env:
51+
CI: true
52+
53+
- name: Run coverage
54+
run: npm run test:coverage
55+
56+
- name: ⬆️ Upload coverage to Codecov
57+
uses: codecov/codecov-action@v1
58+
with:
59+
file: ./coverage/lcov.info
60+
61+
release:
62+
if:
63+
${{ github.repository == 'htmlhint/HTMLHint' &&
64+
contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha',
65+
github.ref) && github.event_name == 'push' }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
steps:
69+
- name: ⬇️ Checkout repo
70+
uses: actions/checkout@v2
71+
72+
- name: ⎔ Setup node
73+
uses: actions/setup-node@v1
74+
75+
- name: 📥 Download deps
76+
uses: bahmutov/npm-install@v1
77+
with:
78+
useLockFile: false
79+
env:
80+
HUSKY_SKIP_INSTALL: true
81+
82+
- name: 🏗 Build
83+
run: npm run build
84+
85+
- name: 🚢 Release
86+
uses: cycjimmy/semantic-release-action@v2
87+
with:
88+
semantic_version: 17
89+
extra_plugins: |
90+
@semantic-release/[email protected]
91+
@semantic-release/[email protected]
92+
branches: |
93+
[
94+
'master',
95+
'next',
96+
'next-major',
97+
{name: 'beta', prerelease: true},
98+
{name: 'alpha', prerelease: true}
99+
]
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
102+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

-39
This file was deleted.

.github/workflows/test-release.yml

+39-14
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,57 @@ name: Test Release
33
on:
44
pull_request:
55
branches:
6+
- '+([0-9])?(.{+([0-9]),x}).x'
7+
- main
68
- master
9+
- alpha
10+
- beta
11+
- next
12+
- next-major
13+
types: [opened, synchronize, reopened]
714

815
jobs:
9-
release:
16+
test-release:
1017
runs-on: ubuntu-latest
1118
strategy:
1219
matrix:
13-
node: [12.x]
20+
node: [14]
1421
os: [ubuntu-latest]
22+
1523
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v1
24+
- name: ⬇️ Checkout repo
25+
uses: actions/checkout@v2
1826

19-
- name: Use Node.js ${{ matrix.node }}
27+
- name: ⎔ Setup node
2028
uses: actions/setup-node@v1
21-
with:
22-
node-version: ${{ matrix.node }}
2329

24-
- name: Install dependencies
25-
run: npm ci
30+
- name: 📥 Download deps
31+
uses: bahmutov/npm-install@v1
32+
with:
33+
useLockFile: false
34+
env:
35+
HUSKY_SKIP_INSTALL: true
2636

27-
- name: Build
28-
run: npm run build --if-present
37+
- name: 🏗 Build
38+
run: npm run build
2939

30-
- name: Semantic Release
31-
run: npx semantic-release --dry-run
40+
- name: 🚢 Release
41+
uses: cycjimmy/semantic-release-action@v2
42+
with:
43+
dry_run: true
44+
semantic_version: 17
45+
extra_plugins: |
46+
@semantic-release/[email protected]
47+
@semantic-release/[email protected]
48+
branches: |
49+
[
50+
'master',
51+
'next',
52+
'next-major',
53+
{name: 'beta', prerelease: true},
54+
{name: 'alpha', prerelease: true}
55+
]
3256
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3458
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
59+

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
"@semantic-release/commit-analyzer",
109109
"@semantic-release/release-notes-generator",
110110
"@semantic-release/changelog",
111+
"@semantic-release/changelog",
111112
"@semantic-release/npm",
112-
"@semantic-release/github",
113113
"@semantic-release/git"
114114
]
115115
},

0 commit comments

Comments
 (0)