Add connection_type to web service docs #2832
Workflow file for this run
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: Staging | |
on: | |
pull_request: | |
push: | |
env: | |
FIREBASE_CHANNEL_ID: "pr-${{github.event.number}}" | |
FIREBASE_PROJECT_ID: mm-dev-site-staging | |
FIREBASE_SERVICE_ACCOUNT: "${{ secrets.STAGING_FIREBASE_SERVICE_ACCOUNT }}" | |
jobs: | |
cache-keys: | |
name: Setup – Cache keys | |
runs-on: ubuntu-latest | |
outputs: | |
build: build-${{ steps.build.outputs.hash }}-v2 | |
dot-cache: dot-cache-${{ github.event.number }}-v1 | |
node-modules: node-modules-${{ steps.node-modules.outputs.hash }}-v1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- id: build | |
run: echo "::set-output name=hash::${{ hashFiles('bin/**', 'content/**', 'firebase/**', 'functions/src/**', 'src/**', 'static/**', 'test/**', '**/package.json', '**/package-lock.json') }}" | |
- id: node-modules | |
run: echo "::set-output name=hash::${{ hashFiles('**/package-lock.json') }}" | |
build: | |
name: Build | |
needs: cache-keys | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached dependencies | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
with: | |
path: | | |
node_modules | |
functions/node_modules | |
key: ${{ needs.cache-keys.outputs.node-modules }} | |
- if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
name: Install dependencies | |
run: npm install | |
- name: Get cached build | |
id: cached-build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
functions/lib | |
public | |
firebase.json | |
key: ${{ needs.cache-keys.outputs.build }} | |
- name: Get .cache cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache | |
key: ${{ needs.cache-keys.outputs.dot-cache }} | |
- if: steps.cached-build.outputs.cache-hit != 'true' | |
name: Build | |
env: | |
GATSBY_URL: https://dev.maxmind.com | |
run: npm run build | |
test-unit: | |
name: Test – Unit | |
needs: [cache-keys, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
functions/node_modules | |
key: ${{ needs.cache-keys.outputs.node-modules }} | |
- name: Run unit tests | |
run: npm run test:unit | |
test-lint: | |
name: Test – Lint | |
needs: [cache-keys, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
functions/node_modules | |
key: ${{ needs.cache-keys.outputs.node-modules }} | |
- name: Run linters | |
run: npm run lint | |
deploy-hosting: | |
name: Deploy – Hosting | |
needs: [cache-keys, build] | |
runs-on: ubuntu-latest | |
# Requires access to our secrets. | |
if: ${{ github.repository_owner == 'maxmind' && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork == false }} | |
outputs: | |
hosting-url: ${{ steps.deploy-preview-channel.outputs.details_url }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
functions/lib | |
public | |
firebase.json | |
key: ${{ needs.cache-keys.outputs.build }} | |
- name: Deploy Firebase preview channel | |
id: deploy-preview-channel | |
uses: FirebaseExtended/action-hosting-deploy@4d0d0023f1d92b9b7d16dda64b3d7abd2c98974b # v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ env.FIREBASE_SERVICE_ACCOUNT }}" | |
expires: 7d | |
projectId: "${{ env.FIREBASE_PROJECT_ID }}" | |
channelId: "${{ env.FIREBASE_CHANNEL_ID }}" | |
env: | |
FIREBASE_CLI_PREVIEWS: hostingchannels | |
- name: Update robots and sitemap files for staging environments | |
env: | |
FIND_AND_REPLACE: s|https://dev.maxmind.com|${{ steps.deploy-preview-channel.outputs.details_url }}|g | |
run: | | |
sed -i "s/Allow:/Disallow:/g" public/robots.txt | |
sed -i "$FIND_AND_REPLACE" public/robots.txt | |
sed -i "$FIND_AND_REPLACE" public/sitemap.xml | |
sed -i "$FIND_AND_REPLACE" public/sitemap-pages.xml | |
- name: Deploy updated files staging environment files | |
uses: FirebaseExtended/action-hosting-deploy@4d0d0023f1d92b9b7d16dda64b3d7abd2c98974b # v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ env.FIREBASE_SERVICE_ACCOUNT }}" | |
expires: 30d | |
projectId: "${{ env.FIREBASE_PROJECT_ID }}" | |
channelId: "${{ env.FIREBASE_CHANNEL_ID }}" | |
env: | |
FIREBASE_CLI_PREVIEWS: hostingchannels | |
deploy-functions: | |
name: Deploy – Functions | |
needs: [cache-keys, build] | |
runs-on: ubuntu-latest | |
# Requires access to our secrets. | |
if: ${{ github.repository_owner == 'maxmind' && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork == false }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
functions/lib | |
public | |
firebase.json | |
key: ${{ needs.cache-keys.outputs.build }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@ee9693ff89cdf73862b8a13988f6a71070e8fc58 # v0.2.1 | |
with: | |
project_id: ${{ env.FIREBASE_PROJECT_ID }} | |
service_account_key: ${{ env.FIREBASE_SERVICE_ACCOUNT }} | |
export_default_credentials: true | |
# Dependencies are needed here to run `npm exec -- firbase` command | |
- name: Get cached dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
functions/node_modules | |
key: ${{ needs.cache-keys.outputs.node-modules }} | |
- name: Deploy all other Firebase resources | |
run: npm exec -- firebase deploy --except hosting --project ${{ env.FIREBASE_PROJECT_ID }} --force | |
test-e2e: | |
name: Test – End-to-end | |
needs: [cache-keys, deploy-hosting, deploy-functions] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Get cached dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
functions/node_modules | |
key: ${{ needs.cache-keys.outputs.node-modules }} | |
- name: Run end-to-end tests | |
env: | |
E2E_TARGET_URL: ${{ needs.deploy-hosting.outputs.hosting-url }} | |
run: npm run test:e2e |