Skip to content

Commit aa7e69f

Browse files
authored
ci: add GitHub Actions CI, Release Please, and Firebase deploy
* Add CI/CD pipeline with GitHub Actions and Firebase Hosting - CI workflow: lint and test on PRs to master - Release Please workflow: automated release PRs and versioning - Deploy workflow: build and deploy to Firebase on version tags - Firebase Hosting config with SPA rewrite and cache headers * ci: rename CI workflow to Lint & Test * ci: add workflow_dispatch trigger to deploy workflow
1 parent cf21971 commit aa7e69f

8 files changed

Lines changed: 123 additions & 0 deletions

File tree

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "minesweeper-fe661"
4+
}
5+
}

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint & Test
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version-file: .nvmrc
19+
cache: npm
20+
21+
- run: npm ci
22+
- run: npm run lint
23+
- run: npm test

.github/workflows/deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version-file: .nvmrc
20+
cache: npm
21+
22+
- run: npm ci
23+
- run: npm run build
24+
25+
- uses: FirebaseExtended/action-hosting-deploy@v0
26+
with:
27+
repoToken: ${{ secrets.GITHUB_TOKEN }}
28+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
29+
channelId: live
30+
projectId: minesweeper-fe661
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: googleapis/release-please-action@v4
16+
with:
17+
config-file: release-please-config.json
18+
manifest-file: .release-please-manifest.json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

firebase.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"hosting": {
3+
"public": "build",
4+
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
5+
"rewrites": [
6+
{
7+
"source": "**",
8+
"destination": "/index.html"
9+
}
10+
],
11+
"headers": [
12+
{
13+
"source": "**/*.@(js|css)",
14+
"headers": [
15+
{
16+
"key": "Cache-Control",
17+
"value": "public, max-age=31536000, immutable"
18+
}
19+
]
20+
},
21+
{
22+
"source": "**/*.@(png|jpg|jpeg|gif|svg|webp|mp3|ogg|wav|json)",
23+
"headers": [
24+
{
25+
"key": "Cache-Control",
26+
"value": "public, max-age=86400"
27+
}
28+
]
29+
}
30+
]
31+
}
32+
}

release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "node",
5+
"bump-minor-pre-major": true,
6+
"bump-patch-for-minor-pre-major": true,
7+
"changelog-path": "CHANGELOG.md"
8+
}
9+
},
10+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
11+
}

0 commit comments

Comments
 (0)