diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 000000000..b6b5ab036 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "pankona-blog" + } +} diff --git a/.github/workflows/generate_site_and_deploy.yaml b/.github/workflows/generate_site_and_deploy.yaml index 64a2f1425..58e180969 100644 --- a/.github/workflows/generate_site_and_deploy.yaml +++ b/.github/workflows/generate_site_and_deploy.yaml @@ -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: @@ -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: diff --git a/firebase.json b/firebase.json new file mode 100644 index 000000000..e78293923 --- /dev/null +++ b/firebase.json @@ -0,0 +1,10 @@ +{ + "hosting": { + "public": "public", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ] + } +} diff --git a/flake.nix b/flake.nix index 535327f62..296bafc1f 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,8 @@ go_1_23 dart-sass + firebase-tools + markdownlint-cli2 yaml-language-server