Skip to content

Commit

Permalink
Add preview channels for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
kvestus committed Feb 24, 2024
1 parent 4fb0b58 commit bf17e67
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ jobs:
path: dist

e2e-chrome-tests:
environment: manual
environment: manual_e2e_tests
timeout-minutes: 15
runs-on: ubuntu-latest
if: github.event.pull_request.merged == false
container:
image: cypress/browsers:node-18.16.0-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
options: --user 1001
Expand Down Expand Up @@ -96,9 +97,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

e2e-chrome-mobile-tests:
environment: manual
environment: manual_e2e_tests
timeout-minutes: 15
runs-on: ubuntu-latest
if: github.event.pull_request.merged == false
container:
image: cypress/browsers:node-18.16.0-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
options: --user 1001
Expand Down Expand Up @@ -145,3 +147,36 @@ jobs:
TEST_USER_USERNAME: ${{ secrets.TEST_USER_USERNAME_2 }}
TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD_2 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy_preview_website:
environment: deploy_preview
needs: [ build ]
runs-on: ubuntu-latest
if: github.event.pull_request.merged == false
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Download artifact
uses: actions/download-artifact@main
with:
name: dist
path: dist
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}"
expires: 7d
projectId: "${{ secrets.GOOGLE_PROJECT_ID }}"

delete_preview_website:
runs-on: ubuntu-latest
if: github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- uses: w9jds/[email protected]
with:
# https://github.com/FirebaseExtended/action-hosting-deploy/issues/60
args: hosting:channel:list | awk -v pr_number="pr${{ github.event.pull_request.number }}" '$0 ~ pr_number { print $2 }' | xargs -I {} firebase hosting:channel:delete {} --force
env:
GCP_SA_KEY: "${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}"
PROJECT_ID: "${{ secrets.GOOGLE_PROJECT_ID }}"

0 comments on commit bf17e67

Please sign in to comment.