Skip to content

Add a new script to automate prod deployment #2182

Add a new script to automate prod deployment

Add a new script to automate prod deployment #2182

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
pull_request:
jobs:
deploy-staging:
# Forks and dependabot cannot access secrets so the job would fail.
# Run for non dependabot PRs or regular pushes to web-platform-tests/wpt.fyi
if: |
(github.repository == 'web-platform-tests/wpt.fyi') &&
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'web-platform-tests/wpt.fyi' && github.actor != 'dependabot[bot]') ||
(github.event_name != 'pull_request'))
name: Deploy staging.wpt.fyi
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: webplatformtests/wpt.fyi:latest
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: secrets
run: echo "$GCLOUD_KEY_FILE_JSON" > client-secret.json
env:
GCLOUD_KEY_FILE_JSON: ${{ secrets.GCLOUD_KEY_FILE_JSON }}
- name: Set DOCKER_INSTANCE
run: echo "DOCKER_INSTANCE=wptd-dev-$(echo $RANDOM)" >> $GITHUB_ENV
- name: pre-installation
run: |
docker pull "${DOCKER_IMAGE}"
bash ./util/docker-dev/run.sh -d -q
- name: installation
run: docker exec -t "${DOCKER_INSTANCE}" make go_build;
# Set -f for main branch.
- name: set deployment flag
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo "FORCE_DEPLOYMENT=-f" >> $GITHUB_ENV
- name: deploy webapp
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" webapp/web/app.staging.yaml
- name: Run go_large_test in main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker exec -t "${DOCKER_INSTANCE}" make go_large_test STAGING=true
- name: build processor
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" results-processor/app.staging.yaml
- name: build searchcache
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" api/query/cache/service/app.staging.yaml
- name: Clean up versions in main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker exec -t "${DOCKER_INSTANCE}" make cleanup_staging_versions