Skip to content

Commit 1db50ed

Browse files
okineadevaklinker1
andauthored
ci: Enhance GitHub Actions workflows (#1370)
Co-authored-by: Aaron <[email protected]>
1 parent 342057b commit 1db50ed

File tree

7 files changed

+195
-62
lines changed

7 files changed

+195
-62
lines changed

.github/actions/setup/action.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
name: Basic Setup
22
description: Install PNPM, Node, and dependencies
3+
34
inputs:
45
install:
56
default: 'true'
7+
type: boolean
68
description: Whether or not to run 'pnpm install'
9+
710
installArgs:
811
default: ''
12+
type: string
913
description: Additional args to append to "pnpm install"
14+
1015
runs:
1116
using: composite
17+
1218
steps:
13-
- name: Setup PNPM
19+
- name: 🛠️ Setup PNPM
1420
uses: pnpm/action-setup@v4
15-
- name: Setup NodeJS
21+
22+
- name: 🛠️ Setup NodeJS
1623
uses: actions/setup-node@v4
1724
with:
1825
node-version: 18
1926
cache: pnpm
20-
- name: Install Dependencies
27+
28+
- name: 📦 Install Dependencies
2129
if: ${{ inputs.install == 'true' }}
2230
shell: bash
2331
run: pnpm install ${{ inputs.installArgs }}

.github/workflows/pkg.pr.new.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continuous Publish
1+
name: 🚀 Continuous Publish
22
on:
33
push:
44
branches:
@@ -7,11 +7,22 @@ on:
77
branches:
88
- main
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
build:
15+
name: Build
1216
runs-on: ubuntu-22.04
1317
steps:
14-
- uses: actions/checkout@v4
15-
- uses: ./.github/actions/setup
16-
- run: pnpm buildc all
17-
- run: pnpx pkg-pr-new publish --compact './packages/*'
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup
22+
uses: ./.github/actions/setup
23+
24+
- name: Build All Packages
25+
run: pnpm buildc all
26+
27+
- name: Publish
28+
run: pnpx pkg-pr-new publish --compact './packages/*'

.github/workflows/publish-docs.yml

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Docs
1+
name: 📝 Publish Docs
22
on:
33
push:
44
branches:
@@ -10,20 +10,38 @@ on:
1010
required: true
1111
default: latest
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
publish:
1518
# Only run if it's the upstream repository, not forks
1619
if: github.repository == 'wxt-dev/wxt'
20+
name: Publish Docs
1721
runs-on: ubuntu-22.04
22+
permissions:
23+
contents: write
1824
steps:
19-
- uses: actions/checkout@v4
20-
- uses: ./.github/actions/setup
21-
- uses: docker/login-action@v3
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup
29+
uses: ./.github/actions/setup
30+
31+
- name: Login to Docker Registry
32+
uses: docker/login-action@v3
2233
with:
2334
registry: https://${{ secrets.DOCKER_REGISTRY_HOSTNAME }}
2435
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
2536
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
26-
- run: pnpm docs:build
27-
- run: docker build docs/.vitepress -t ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
28-
- run: docker push ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
29-
- run: curl -X POST -i ${{ secrets.UPDATE_DOCS_WEBHOOK }}
37+
38+
- name: Build docs
39+
run: |
40+
pnpm docs:build
41+
docker build docs/.vitepress -t ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
42+
43+
- name: Push Image
44+
run: docker push ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
45+
46+
- name: Deploy
47+
run: curl -X POST -i ${{ secrets.UPDATE_DOCS_WEBHOOK }}

.github/workflows/release.yml

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: 🚀 Release
22
on:
33
workflow_dispatch:
44
inputs:
@@ -17,40 +17,51 @@ on:
1717
- unocss
1818
- wxt
1919

20+
permissions:
21+
contents: read
22+
2023
jobs:
2124
validate:
25+
name: Validate
2226
uses: './.github/workflows/validate.yml'
2327
secrets: inherit
2428

2529
publish:
30+
name: Publish
2631
runs-on: ubuntu-22.04
2732
permissions:
2833
contents: write
2934
needs:
3035
- validate
3136
steps:
32-
- uses: actions/checkout@v4
37+
- name: Checkout
38+
uses: actions/checkout@v4
3339
with:
3440
fetch-depth: 0
3541

36-
- uses: ./.github/actions/setup
42+
- name: Setup
43+
uses: ./.github/actions/setup
44+
45+
- name: Configure Git
46+
run: |
47+
git config user.name 'github-actions[bot]'
48+
git config user.email 'github-actions[bot]@users.noreply.github.com'
49+
git config --global push.followTags true
3750
3851
- name: Bump and Tag
3952
run: |
40-
git config user.email "[email protected]"
41-
git config user.name "GitHub Actions"
4253
pnpm tsx scripts/bump-package-version.ts ${{ inputs.package }}
4354
git push
4455
git push --tags
4556
46-
- name: NPM
57+
- name: Publish to NPM
58+
working-directory: packages/${{ inputs.package }}
4759
run: |
4860
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
4961
pnpm build
5062
pnpm publish
51-
working-directory: packages/${{ inputs.package }}
5263
53-
- name: GitHub Release
64+
- name: Create GitHub release
5465
run: pnpm tsx scripts/create-github-release.ts ${{ inputs.package }}
5566
env:
5667
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/sync-releases.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Sync Releases
1+
name: 🔄 Sync Releases
22
on:
33
workflow_dispatch:
44
inputs:
@@ -16,14 +16,25 @@ on:
1616
- storage
1717
- wxt
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
sync:
24+
name: Sync Releases
2125
runs-on: ubuntu-22.04
26+
permissions:
27+
contents: write
2228
steps:
23-
- uses: actions/checkout@v4
24-
- uses: ./.github/actions/setup
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup
33+
uses: ./.github/actions/setup
2534
with:
2635
installArgs: --ignore-scripts
27-
- run: pnpm tsx scripts/sync-releases.ts ${{ inputs.package }}
36+
37+
- name: Sync Releases
38+
run: pnpm tsx scripts/sync-releases.ts ${{ inputs.package }}
2839
env:
2940
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

+86-27
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,95 @@
1-
name: Validate
1+
name: Validate
22
on:
33
workflow_call:
44
pull_request:
55
push:
66
branches:
77
- main
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
checks:
14+
name: Checks
1115
runs-on: ubuntu-22.04
1216
steps:
13-
- uses: actions/checkout@v4
14-
- uses: ./.github/actions/setup
15-
- run: pnpm check
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup
21+
uses: ./.github/actions/setup
22+
23+
- name: Type Check
24+
run: pnpm check
25+
1626
builds:
27+
name: Builds
1728
runs-on: ubuntu-22.04
1829
steps:
19-
- uses: actions/checkout@v4
20-
- uses: ./.github/actions/setup
21-
- run: pnpm buildc all
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup
34+
uses: ./.github/actions/setup
35+
36+
- name: Build All Packages
37+
run: pnpm buildc all
38+
2239
build-demo:
40+
name: Build Demo
2341
runs-on: ubuntu-22.04
2442
steps:
25-
- uses: actions/checkout@v4
26-
- uses: ./.github/actions/setup
27-
- run: pnpm build:all
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Setup
47+
uses: ./.github/actions/setup
48+
49+
- name: Build
50+
run: pnpm build:all
2851
working-directory: packages/wxt-demo
29-
- run: pnpm wxt zip
52+
53+
- name: ZIP
54+
run: pnpm wxt zip
3055
working-directory: packages/wxt-demo
56+
3157
tests:
58+
name: Tests
3259
runs-on: ubuntu-22.04
3360
steps:
34-
- uses: actions/checkout@v4
35-
- uses: ./.github/actions/setup
36-
- uses: oven-sh/setup-bun@v2
37-
- name: pnpm test:coverage
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
64+
- name: Setup
65+
uses: ./.github/actions/setup
66+
67+
- name: Setup Bun
68+
uses: oven-sh/setup-bun@v2
69+
70+
- name: Run Tests
3871
run: pnpm test:coverage -- --reporter=default --reporter=hanging-process
39-
- uses: codecov/codecov-action@v5
72+
73+
- name: Upload Coverage
74+
uses: codecov/codecov-action@v5
4075
env:
4176
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
77+
4278
windows-tests:
79+
name: Windows Tests
4380
runs-on: windows-latest
4481
steps:
45-
- uses: actions/checkout@v4
46-
- uses: ./.github/actions/setup
47-
- run: pnpm test
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
85+
- name: Setup
86+
uses: ./.github/actions/setup
87+
88+
- name: Run Tests
89+
run: pnpm test
90+
4891
template:
92+
name: Template
4993
runs-on: ubuntu-22.04
5094
strategy:
5195
fail-fast: false
@@ -57,19 +101,34 @@ jobs:
57101
- vanilla
58102
- vue
59103
steps:
60-
- uses: actions/checkout@v4
61-
- uses: ./.github/actions/setup
62-
- run: pnpm pack
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
107+
- name: Setup
108+
uses: ./.github/actions/setup
109+
110+
- name: Pack WXT package
111+
run: pnpm pack
63112
working-directory: packages/wxt
64-
- run: npm i
113+
114+
- name: Install Dependencies
115+
run: npm i
65116
working-directory: templates/${{ matrix.template }}
66-
- run: npm i -D ../../packages/wxt/wxt-*.tgz
117+
118+
- name: Install Packed WXT
119+
run: npm i -D ../../packages/wxt/wxt-*.tgz
67120
working-directory: templates/${{ matrix.template }}
68-
- run: pnpm compile
121+
122+
- name: Type Check Template
123+
run: pnpm compile
69124
if: matrix.template != 'svelte'
70125
working-directory: templates/${{ matrix.template }}
71-
- run: pnpm check
126+
127+
- name: Type Check Template
128+
run: pnpm check
72129
if: matrix.template == 'svelte'
73130
working-directory: templates/${{ matrix.template }}
74-
- run: pnpm build
131+
132+
- name: Build Template
133+
run: pnpm build
75134
working-directory: templates/${{ matrix.template }}

0 commit comments

Comments
 (0)