Skip to content

Commit e26c741

Browse files
authored
Add Firebase hosting preview environment for PRs (#371)
* Add Firebase hosting preview environment for PRs Add a new GitHub Actions workflow to deploy to Firebase hosting preview environment on PR. * Create a new workflow file `.github/workflows/deploy-preview.yaml`. * Set the workflow to trigger on pull requests. * Use the Firebase hosting deploy action to deploy to the preview environment. * Configure the PR environment to live for 7 days using the `expires` parameter. * Update the `uses` action to the correct versions. * Utilize `yarn` instead of `npm` for installing dependencies and building the project. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/cohstats/coh2stats?shareId=XXXX-XXXX-XXXX-XXXX). * Update deploy-preview.yaml * Update deploy-preview.yaml * Prettier
1 parent 87191b3 commit e26c741

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy Preview Environment
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
deploy-preview:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "20"
19+
20+
- name: Install dependencies
21+
run: yarn --prefer-offline --frozen-lockfile install
22+
23+
- name: Build project
24+
run: yarn web build
25+
26+
- name: Deploy to Firebase preview channel
27+
uses: FirebaseExtended/action-hosting-deploy@v0
28+
with:
29+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
30+
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_COH2_LADDERS_PROD }}"
31+
projectId: "coh2-ladders-prod"
32+
target: "coh2-ladders-dev"
33+
channelId: "pr-${{ github.event.number }}"
34+
expires: 7d

0 commit comments

Comments
 (0)