Skip to content

Commit 9851667

Browse files
committed
initial s3 workflow
1 parent 279e5ed commit 9851667

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

.github/workflows/deploy-web.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,16 @@ jobs:
3737
run: yarn lint
3838
working-directory: ${{ env.WORKING_DIRECTORY }}
3939

40-
- name: Deploy to surge
41-
run: yarn deploy
40+
- name: Configure AWS credentials using OIDC
41+
uses: aws-actions/configure-aws-credentials@v2
42+
with:
43+
role-to-assume: arn:aws:iam::003081160852:role/osm-gradient-deploy-s3-role
44+
aws-region: us-east-1
45+
46+
- name: Build
47+
run: vite build
48+
working-directory: ${{ env.WORKING_DIRECTORY }}
49+
50+
- name: Deploy to S3
4251
working-directory: ${{ env.WORKING_DIRECTORY }}
43-
env:
44-
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
52+
run: aws s3 sync ./dist s3://gradient.osmcha.org --delete

.github/workflows/preview.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Surge PR Preview
2+
3+
on: [pull_request]
4+
5+
env:
6+
NODE: 18
7+
WORKING_DIRECTORY: packages/web
8+
9+
jobs:
10+
preview:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write # allow surge-preview to create/update PR comments
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Use Node.js ${{ env.NODE }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ env.NODE }}
22+
cache: "yarn"
23+
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/yarn.lock
24+
25+
- name: Install Dependencies
26+
run: yarn install
27+
working-directory: ${{ env.WORKING_DIRECTORY }}
28+
29+
- name: Lint
30+
run: yarn lint
31+
working-directory: ${{ env.WORKING_DIRECTORY }}
32+
33+
- uses: afc163/surge-preview@v1
34+
id: preview_step
35+
with:
36+
surge_token: ${{ secrets.SURGE_TOKEN }}
37+
dist: dist
38+
build: |
39+
vite build
40+
- name: Get the preview_url
41+
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"

0 commit comments

Comments
 (0)