mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-18 22:00:37 -05:00
64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
name: '[CI] Build Latest'
|
|
|
|
on:
|
|
push: # Only run on merges into main that modify files under pyscriptjs/
|
|
branches:
|
|
- main
|
|
paths:
|
|
- pyscriptjs/**
|
|
- .github/workflows/build-latest.yml # Test that workflow works when changed
|
|
|
|
pull_request: # Run on any PR that modifies files in pyscriptjs/
|
|
branches:
|
|
- main
|
|
paths:
|
|
- pyscriptjs/**
|
|
- .github/workflows/build-latest.yml # Test that workflow works when changed
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
defaults:
|
|
run:
|
|
working-directory: pyscriptjs
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Install node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18.x
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- name: Install dependencies
|
|
run: |
|
|
npm install
|
|
- name: Build pyscript
|
|
run: |
|
|
npm run build
|
|
|
|
# Deploy to S3
|
|
- name: Configure AWS credentials
|
|
if: github.ref == 'refs/heads/main' # Only deploy on merge into main
|
|
uses: aws-actions/configure-aws-credentials@v1.6.1
|
|
with:
|
|
aws-region: ${{secrets.AWS_REGION}}
|
|
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
|
|
- name: Sync to S3
|
|
if: github.ref == 'refs/heads/main'
|
|
run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/unstable
|