Skip to content

Commit

Permalink
Switch to Github Workflows for deployment. Part 1. (#31)
Browse files Browse the repository at this point in the history
* Switch to Github Workflows for deployment. Part 1.

* Fix build

* Add check-format script
  • Loading branch information
joeldenning authored Sep 23, 2024
1 parent b0e285b commit 1e958ab
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 95 deletions.
93 changes: 0 additions & 93 deletions .circleci/config.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [joeldenning]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
62 changes: 62 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build, Test, Release

on:
push:
branches: main
pull_request:
branches: "*"

jobs:
build_test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Test
run: |
pnpm run lint
pnpm run check-format
pnpm run test
- name: Build
run: pnpm run build

- name: Store artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

release:
name: Release
needs: build_test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist

- name: Authenticate with GCP
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/654158993889/locations/global/workloadIdentityPools/github/providers/my-repo"

- name: Upload Static Files to CDN
uses: "google-github-actions/upload-cloud-storage@v2"
with:
path: dist
destination: "react.microfrontends.app/people/${{ env.GITHUB_RUN_ID }}/"
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm exec pretty-quick --staged && pnpm exec concurrently yarn:test yarn:lint
pnpm exec pretty-quick --staged && pnpm exec concurrently pnpm:test pnpm:lint
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"lint": "eslint src",
"test": "jest --passWithNoTests",
"watch-tests": "jest --watch",
"check-format": "prettier --check .",
"format": "prettier --write .",
"coverage": "jest --coverage",
"prepare": "husky"
Expand Down Expand Up @@ -51,5 +52,6 @@
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
},
"packageManager": "pnpm@9.11.0"
}

0 comments on commit 1e958ab

Please sign in to comment.