Skip to content

Commit

Permalink
Move GCS lookaside deployment to Github Actions
Browse files Browse the repository at this point in the history
Moving here because the prod deployment is on Github Pages, and overall
the integration is cleaner with Actions rather than CircleCI.
  • Loading branch information
neillrobson committed Jun 6, 2024
1 parent e1f06f7 commit 6742f21
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ workflows:
name: build
requires:
- setup
- deploy-lookaside-gcs:
<<: *dev
name: deploy-lookaside-gcs
context:
- core-dev
requires:
- setup
- build
# - deploy-lookaside-gcs:
# <<: *dev
# name: deploy-lookaside-gcs
# context:
# - core-dev
# requires:
# - setup
# - build
- pr-comment:
<<: *dev
name: pr-comment
context: core-dev
requires:
- deploy-lookaside-gcs
# requires:
# - deploy-lookaside-gcs

56 changes: 56 additions & 0 deletions .github/workflows/lookaside.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: GCS Lookaside

on:
push:
branches-ignore:
- main

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Prepare npmrc
run: envsubst < ci.npmrc > .npmrc
env:
ARTIFACTORY_TOKEN: '${{ secrets.ARTIFACTORY_TOKEN }}'
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: dist

# Deployment job
deploy:
environment:
name: google-cloud-storage
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: dist
- name: Add service key
run: echo ${{ secrets.GCLOUD_SERVICE_KEY }} > "gcloud-service-key.json"
- name: Deploy to Google Cloud Storage
id: deployment
run: node scripts/lookaside.mjs --keyFilename=gcloud-service-key.json --branch ${{ github.ref_name }}
1 change: 1 addition & 0 deletions scripts/lookaside.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async function run() {

await Promise.all(uploads);
console.log(logSymbols.success, 'Lookaside deployed');
process.env.GITHUB_OUTPUT = `page_url=https://storage.googleapis.com/prism-design-system/${branch}/index.html`;
} catch (error) {
console.log(logSymbols.error, error);
process.exit(1);
Expand Down

0 comments on commit 6742f21

Please sign in to comment.