github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/.github/workflows/deploy.yml (about) 1 name: Deploy 2 on: 3 push: 4 branches: 5 - main 6 pull_request: 7 jobs: 8 deploy-staging: 9 # Forks and dependabot cannot access secrets so the job would fail. 10 # Run for non dependabot PRs or regular pushes to web-platform-tests/wpt.fyi 11 if: | 12 (github.repository == 'web-platform-tests/wpt.fyi') && 13 ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'web-platform-tests/wpt.fyi' && github.actor != 'dependabot[bot]') || 14 (github.event_name != 'pull_request')) 15 name: Deploy staging.wpt.fyi 16 runs-on: ubuntu-latest 17 env: 18 DOCKER_IMAGE: webplatformtests/wpt.fyi:latest 19 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 20 steps: 21 - uses: actions/checkout@v3 22 with: 23 fetch-depth: 2 24 25 - name: secrets 26 run: echo "$GCLOUD_KEY_FILE_JSON" > client-secret.json 27 env: 28 GCLOUD_KEY_FILE_JSON: ${{ secrets.GCLOUD_KEY_FILE_JSON }} 29 30 - name: Set DOCKER_INSTANCE 31 run: echo "DOCKER_INSTANCE=wptd-dev-$(echo $RANDOM)" >> $GITHUB_ENV 32 33 - name: pre-installation 34 run: | 35 docker pull "${DOCKER_IMAGE}" 36 bash ./util/docker-dev/run.sh -d -q 37 38 - name: installation 39 run: docker exec -t "${DOCKER_INSTANCE}" make go_build; 40 41 # Set -f for main branch. 42 - name: set deployment flag 43 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} 44 run: echo "FORCE_DEPLOYMENT=-f" >> $GITHUB_ENV 45 46 - name: deploy webapp 47 run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" webapp/web/app.staging.yaml 48 49 - name: Run go_large_test in main 50 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} 51 run: docker exec -t "${DOCKER_INSTANCE}" make go_large_test STAGING=true 52 53 - name: build processor 54 run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" results-processor/app.staging.yaml 55 56 - name: build searchcache 57 run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" api/query/cache/service/app.staging.yaml 58 59 - name: Clean up versions in main 60 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} 61 run: docker exec -t "${DOCKER_INSTANCE}" make cleanup_staging_versions