Even better PyEditor offline use case (#2050) #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Publish Unstable" | |
on: | |
push: # Only run on merges into main that modify files under pyscript.core/ and examples/ | |
branches: | |
- main | |
paths: | |
- pyscript.core/** | |
- examples/** | |
workflow_dispatch: | |
jobs: | |
publish-unstable: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
working-directory: ./pyscript.core | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
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: NPM Install | |
run: npm install && npx playwright install | |
- name: Build | |
run: npm run build | |
- name: Generate index.html in snapshot | |
working-directory: . | |
run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} | |
- name: Sync to S3 | |
run: aws s3 sync --quiet ./dist/ s3://pyscript.net/unstable/ |