Skip to content

Commit 2b7e276

Browse files
author
Joel Denning
authored
Add example github workflow (#174)
1 parent 927d83a commit 2b7e276

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build, Test, Release
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: "*"
8+
9+
jobs:
10+
build_test:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v4
17+
- name: Install Pnpm
18+
uses: pnpm/action-setup@v4
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
cache: pnpm
24+
- name: Install dependencies
25+
run: pnpm install --frozen-lockfile
26+
27+
- name: Test
28+
run: |
29+
pnpm run lint
30+
pnpm run check-format
31+
pnpm run test
32+
33+
- name: Build
34+
run: pnpm run build
35+
36+
- name: Store artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: dist
40+
path: dist
41+
42+
release:
43+
name: Release
44+
needs: build_test
45+
runs-on: ubuntu-latest
46+
if: ${{ github.ref == 'refs/heads/main' }}
47+
permissions:
48+
contents: "read"
49+
id-token: "write"
50+
51+
steps:
52+
- name: Download build artifact
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: dist
56+
57+
- name: Authenticate with GCP
58+
uses: "google-github-actions/auth@v2"
59+
with:
60+
project_id: neural-passkey-248222
61+
workload_identity_provider: "projects/654158993889/locations/global/workloadIdentityPools/github/providers/my-repo"
62+
service_account: github-workload-identity-feder@neural-passkey-248222.iam.gserviceaccount.com
63+
64+
- name: Upload Static Files to CDN
65+
uses: "google-github-actions/upload-cloud-storage@v2"
66+
with:
67+
path: .
68+
destination: react.microfrontends.app/${{ github.event.repository.name }}/${{ github.run_id }}
69+
70+
- name: Update Import Map
71+
uses: single-spa/action-deploy-to-import-map-deployer@v1
72+
with:
73+
host: ${{ secrets.DEPLOYER_HOST }}
74+
username: ${{ secrets.DEPLOYER_USERNAME }}
75+
password: ${{ secrets.DEPLOYER_PASSWORD }}
76+
service-name: "@react-mf/${{ github.event.repository.name }}"
77+
service-url: "https://react.microfrontends.app/${{ github.event.repository.name }}/${{ github.run_id }}/react-mf-${{ github.event.repository.name }}.js"
78+
service-integrity-file-path: react-mf-${{ github.event.repository.name }}.js

0 commit comments

Comments
 (0)