diff --git a/.github/workflows/pull-request-staging.yml b/.github/workflows/pull-request-staging.yml index ff4b610..eaa4f0a 100644 --- a/.github/workflows/pull-request-staging.yml +++ b/.github/workflows/pull-request-staging.yml @@ -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 @@ -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/