8000 Split build jobs, add S3 push (#307) · whatevergeek/pyscript@bc4581d · GitHub
[go: up one dir, main page]

Skip to content

Commit bc4581d

Browse files
Split build jobs, add S3 push (pyscript#307)
* split files, add s3 push * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * dedent * indent * alpha directory * remove on: PR from alpha * workflow names * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove js-lint.yml (replaced by pre-commit); add sync-examples.yml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update sync-examples.yml * change unstable to latest, master -> main Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3dc90c4 commit bc4581d

File tree

3 files changed

+70
-15
lines changed

3 files changed

+70
-15
lines changed
< 8000 /div>
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
name: Build
1+
name: '[CI] Build Alpha'
22

33
on:
4-
push: # Only run on merges into master that modify files under pyscriptjs/
5-
branches: main
4+
push:
5+
tags:
6+
- '**' # Currently any tag, need to slim down
67
paths:
78
- pyscriptjs/**
8-
- .github/workflows/** # Test that workflows work when changed
9-
10-
pull_request: # Run on any PR that modifies files in pyscriptjs/
11-
paths:
12-
- pyscriptjs/**
13-
- .github/workflows/**
9+
- .github/workflows/build-alpha.yml # Test that workflow works when changed
1410

1511
jobs:
1612
build:
1713
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
1817
defaults:
1918
run:
2019
working-directory: ./pyscriptjs
20+
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v3
@@ -30,7 +30,7 @@ jobs:
3030
env:
3131
cache-name: cache-node-modules
3232
with:
33-
# npm cache files are stored in `~/.npm` on Linux/macOS
33+
# npm cache files are stored in `~/.npm` on Linux/macOS
3434
path: ~/.npm
3535
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
3636
restore-keys: |
@@ -43,3 +43,11 @@ jobs:
4343
- name: Build pyscript
4444
run: |
4545
npm run build
46+
# Deploy to S3
47+
- name: Configure AWS credentials
48+
uses: aws-actions/configure-aws-credentials@v1.6.1
49+
with:
50+
aws-region: ${{secrets.AWS_REGION}}
51+
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
52+
- name: Sync to S3
53+
run: aws s3 sync . s3://pyscript-static/alpha/ # What artifacts exactly need to be copied?

.github/workflows/lint.yml renamed to .github/workflows/build-latest.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
name: Lint
1+
name: '[CI] Build Latest'
22

33
on:
4-
push: # Only run on merges into master that modify files under pyscriptjs/
4+
push: # Only run on merges into main that modify files under pyscriptjs/
55
branches:
66
- main
7+
paths:
8+
- pyscriptjs/**
9+
- .github/workflows/build-latest.yml # Test that workflow works when changed
710

811
pull_request: # Run on any PR that modifies files in pyscriptjs/
12+
paths:
13+
- pyscriptjs/**
14+
- .github/workflows/**
915

1016
jobs:
1117
build:
1218
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
id-token: write
1322
defaults:
1423
run:
1524
working-directory: ./pyscriptjs
25+
1626
steps:
1727
- name: Checkout
1828
uses: actions/checkout@v3
@@ -25,7 +35,7 @@ jobs:
2535
env:
2636
cache-name: cache-node-modules
2737
with:
28-
# npm cache files are stored in `~/.npm` on Linux/macOS
38+
# npm cache files are stored in `~/.npm` on Linux/macOS
2939
path: ~/.npm
3040
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
3141
restore-keys: |
@@ -35,6 +45,14 @@ jobs:
3545
- name: Install dependencies
3646
run: |
3747
npm install
38-
- name: Run linter
48+
- name: Build pyscript
3949
run: |
40-
npm run lint
50+
npm run build
51+
# Deploy to S3
52+
- name: Configure AWS credentials
53+
uses: aws-actions/configure-aws-credentials@v1.6.1
54+
with:
55+
aws-region: ${{secrets.AWS_REGION}}
56+
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
57+
- name: Sync to S3
58+
run: aws s3 sync . s3://pyscript-static/unstable/ # What artifacts exactly need to be copied?

.github/workflows/sync-examples.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: '[CI] Sync Examples'
2+
3+
on:
4+
push: # Only run on merges into main that modify files under pyscriptjs/examples/
5+
branches:
6+
- main
7+
paths:
8+
- pyscriptjs/examples/**
9+
- .github/workflows/sync-examples.yml # Test that workflow works when changed
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
17+
defaults:
18+
run:
19+
working-directory: ./pyscriptjs/examples
20+
21+
steps:
22+
# Deploy to S3
23+
- name: Configure AWS credentials
24+
uses: aws-actions/configure-aws-credentials@v1.6.1
25+
with:
26+
aws-region: ${{secrets.AWS_REGION}}
27+
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
28+
- name: Sync to S3
29+
run: aws s3 sync . s3://pyscript-static/examples/

0 commit comments

Comments
 (0)
0