Deploy Preview #325
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Preview | |
on: | |
workflow_run: | |
workflows: | |
- Start Preview Deployment | |
types: | |
- completed | |
permissions: | |
id-token: write | |
contents: read | |
deployments: write | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
concurrency: | |
group: staging-web | |
steps: | |
- name: Checkout the repository | |
uses: actions/[email protected] | |
- name: Download server from prepare step | |
uses: actions/[email protected] | |
with: | |
name: preview-server | |
repository: ${{ github.repository_owner }}/${{ github.event.repository.name }} | |
run-id: ${{ github.event.workflow_run.id }} | |
github-token: ${{ secrets.PREVIEW_ARTIFACT_PAT }} | |
- name: Extract archive to restore symlinks | |
run: tar -xf server.tar | |
- name: Extract PR number | |
run: | | |
PR_NUMBER=$(cat ./preview-id) | |
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | |
- name: Notify about new deployment | |
uses: bobheadxi/[email protected] | |
id: status | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.event.workflow_run.head_commit.id }} | |
env: preview-${{ env.PR_NUMBER }} | |
- name: Deploy to Google Cloud | |
id: deploy | |
uses: ./.github/actions/deploy | |
with: | |
projectId: slowreader-421120 | |
region: europe-west1 | |
folder: ./server/ | |
registry: staging/server | |
service: staging-server | |
tag: preview-${{ env.PR_NUMBER }} | |
env: ASSETS=1,PROXY_ORIGIN=^https:\/\/preview-\d+---staging-server-jfj4bxwwxq-ew\.a\.run\.app$ | |
flags: | | |
--update-secrets=DATABASE_URL=preview-db-url:latest | |
- name: Update deployment status | |
uses: bobheadxi/[email protected] | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
env: ${{ steps.status.outputs.env }} | |
env_url: ${{ steps.deploy.outputs.url }}/ui/ | |
deployment_id: ${{ steps.status.outputs.deployment_id }} |