Skip to content

Commit

Permalink
Merge pull request #342 from pankona/staging-firebase
Browse files Browse the repository at this point in the history
Implement staging deployment with firebase
  • Loading branch information
pankona authored Jan 9, 2025
2 parents 36dbd0f + 13c12e6 commit 0ce558b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "pankona-blog"
}
}
40 changes: 33 additions & 7 deletions .github/workflows/generate_site_and_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ on:
- main
pull_request:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Default to bash
defaults:
run:
Expand Down Expand Up @@ -56,7 +50,39 @@ jobs:
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:

deploy-staging:
permissions:
checks: write
contents: read
pull-requests: write
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- uses: actions/checkout@v4
- name: Download build assets
env:
GH_TOKEN: ${{ github.token }}
run: |
gh run download --repo '${{ github.repository }}'
- name: Extract the downloaded artifact
run: |
mkdir public
tar -xf ./github-pages/artifact.tar -C public
tree ./public
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANKONA_BLOG }}
projectId: pankona-blog

deploy-production:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
Expand Down
10 changes: 10 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
go_1_23
dart-sass

firebase-tools

markdownlint-cli2

yaml-language-server
Expand Down

0 comments on commit 0ce558b

Please sign in to comment.