-
Notifications
You must be signed in to change notification settings - Fork 3
168 lines (163 loc) · 5.47 KB
/
Copy pathtest-release.yml
File metadata and controls
168 lines (163 loc) · 5.47 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Test & Release
on:
push:
branches-ignore:
- 'gh-pages'
- 'depfu/**'
- 'dependabot/**'
- 'template-updater/**'
pull_request: null
jobs:
tests:
name: Unit Tests
runs-on: ubuntu-latest
if: github.repository != 'sebbo2002/js-template' && (contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main')
strategy:
matrix:
node: [22.x, 24.x, 25.x, current]
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v7
- name: 🔧 Set up Python
uses: actions/setup-python@v6
with:
# https://github.com/aio-libs/aiohttp/issues/7739#issuecomment-1773868351
python-version: 3.11
- name: 🔧 Setup pip cache
uses: actions/cache@v5
id: pip-cache
with:
path: ~/.cache/pip
key: pip
- name: 📦 Install pyatv
run: pip3 install --upgrade git+https://github.com/postlund/pyatv.git
- name: 🔧 Setup node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: ⏳ Run tests
run: npm run test
coverage:
name: Code Coverage / Lint
runs-on: ubuntu-latest
if: github.repository != 'sebbo2002/js-template' && (contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main')
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v7
- name: 🔧 Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: 🔧 Setup pip cache
uses: actions/cache@v5
id: pip-cache
with:
path: ~/.cache/pip
key: pip
- name: 📦 Install pyatv
run: pip3 install --upgrade git+https://github.com/postlund/pyatv.git
- name: 🔧 Setup node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🔍 Run linter
run: npm run lint
- name: ⚙️ Build project
run: npm run build-all
license-checker:
name: License Checker
runs-on: ubuntu-latest
if: contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main'
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v7
- name: 🔧 Setup node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🕵️♀️ Run license checker
run: npm run license-check
release:
name: Release
runs-on: ubuntu-latest
concurrency: release
permissions:
contents: write
id-token: write
issues: write
packages: write
pages: write
pull-requests: write
needs:
- coverage
- tests
- license-checker
if: ${{ github.repository != 'sebbo2002/js-template' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }}
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v7
- name: 🔧 Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: 🔧 Setup pip cache
uses: actions/cache@v5
id: pip-cache
with:
path: ~/.cache/pip
key: pip
- name: 📦 Install pyatv
run: pip3 install --upgrade git+https://github.com/postlund/pyatv.git
- name: 🔧 Setup node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- name: 📦 Ensure npm ≥ 11.5.1
run: |
REQUIRED_VERSION="11.5.1"
CURRENT_VERSION=$(npm -v)
echo "Current npm version: $CURRENT_VERSION"
SMALLEST=$(printf '%s\n' "$CURRENT_VERSION" "$REQUIRED_VERSION" | sort -V | head -n1)
if [ "$CURRENT_VERSION" = "$REQUIRED_VERSION" ] || [ "$SMALLEST" = "$REQUIRED_VERSION" ]; then
echo "npm version ($CURRENT_VERSION) meets the requirement ($REQUIRED_VERSION)."
else
echo "Updating npm to latest version..."
npm install -g npm@latest
fi
- name: 📦 Install dependencies
run: npm ci
- name: 📂 Create docs folder
run: mkdir ./docs
- name: 🪄 Run semantic-release
run: BRANCH=${GITHUB_REF#refs/heads/} npx semantic-release
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_OWNER: ${{ github.repository_owner }}
NPM_CONFIG_PROVENANCE: true
npm_config_access: public
- name: 🌎 Deploy GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: ./${GITHUB_REF#refs/heads/}
- name: 🔃 Merge main back into develop
if: ${{ github.ref == 'refs/heads/main' }}
uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_ref: 'main'
target_branch: 'develop'
commit_message_template: 'Merge branch {source_ref} into {target_branch} [skip ci]'