Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Deploy staging server after UI URL has been determined
Browse files Browse the repository at this point in the history
  • Loading branch information
imyourmanzi committed May 9, 2023
1 parent b0203dc commit 6102a81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pull-request-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ jobs:
- run: npm ci
- run: cp firebase.json tmp.json && jq '(.hosting.rewrites[] | select(.source == "/api/**").run.serviceId) = $serviceId' tmp.json --arg serviceId 'staging-server' > firebase.json
- run: npx nx build ui
- uses: FirebaseExtended/action-hosting-deploy@v0
- id: deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_IMYOURMANZI_SPOTIFYPLAYLISTMGR }}
projectId: imyourmanzi-spotifyplaylistmgr
channelId: staging
outputs:
url: ${{ steps.deploy.outputs.urls[0] }}
server:
name: 'Deploy PR #${{ github.event.pull_request.number }} to Staging Server'
if: github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed'
runs-on: ubuntu-latest
environment: staging
concurrency: 'staging:server'
needs: ui
steps:
- uses: actions/checkout@v3
- id: gcp_auth
Expand All @@ -45,4 +49,4 @@ jobs:
- run: docker build --platform=linux/amd64 . -t us-central1-docker.pkg.dev/imyourmanzi-spotifyplaylistmgr/server-images/server:pr-${{ github.event.pull_request.number }}-latest
- run: echo '${{ steps.gcp_auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev
- run: docker push us-central1-docker.pkg.dev/imyourmanzi-spotifyplaylistmgr/server-images/server:pr-${{ github.event.pull_request.number }}-latest
- run: gcloud run deploy staging-server --region us-central1 --image us-central1-docker.pkg.dev/imyourmanzi-spotifyplaylistmgr/server-images/server:pr-${{ github.event.pull_request.number }}-latest
- run: gcloud run deploy staging-server --region us-central1 --image us-central1-docker.pkg.dev/imyourmanzi-spotifyplaylistmgr/server-images/server:pr-${{ github.event.pull_request.number }}-latest --revision-suffix "pr-${{ github.event.pull_request.number }}-$(date +'%Y%m%d-%H%M%S')" --update-env-vars==SPOTIFY_REDIRECT_URI=${{ needs.ui.outputs.url }}/callback/

0 comments on commit 6102a81

Please sign in to comment.