fix: Only update py-shiny submodule #427
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: Build and deploy shinylive | |
on: | |
push: | |
branches: [main, deploy] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
workflow_run: | |
workflows: [Update py-shiny submodule] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Check out submodules | |
run: | | |
make submodules | |
- name: Build shinylive | |
run: | | |
make all | |
# ===================================================== | |
# Run playwright tests | |
# ===================================================== | |
# Note: These are disabled because of a circular dependency between this | |
# repository and Python shinylive package (which is in the py-shinylive | |
# repository). This set of tests does a `pip install shinylive`, but that | |
# package depends on this repo, and can only be updated after a release is | |
# made from this repo. But if these tests fail, it will block this repo | |
# from making a release. To fix this, we will probably need to avoid | |
# installing the Python package. | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: "14.x" | |
# - name: Install dependencies | |
# run: yarn | |
# - name: Install Shinylive Python pacakge | |
# run: pip install shinylive | |
# - name: Install Playwright Browsers | |
# run: npx playwright install --with-deps | |
# - name: Run Playwright tests | |
# run: make test | |
# - uses: actions/upload-artifact@v3 | |
# if: always() | |
# with: | |
# name: playwright-report | |
# path: playwright-report/ | |
# retention-days: 30 | |
# ===================================================== | |
# Publish to AWS for shinylive.io | |
# ===================================================== | |
- name: Configure AWS Credentials | |
if: github.ref == 'refs/heads/deploy' | |
uses: aws-actions/configure-aws-credentials@v2 | |
env: | |
AWS_ACCOUNT_ID: "341745101194" | |
AWS_REGION: us-east-1 | |
with: | |
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/ShinyliveDeploy | |
role-session-name: gha-deploy-shinylive | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Deploy to S3 | |
if: github.ref == 'refs/heads/deploy' | |
env: | |
AWS_CLOUDFRONT_DISTRIBUTION_ID: "E2SN9UWE8YY9EG" | |
run: | | |
pip install awscli | |
aws s3 sync _shinylive s3://shinylive.io --delete | |
aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*" | |
# ===================================================== | |
# Upload _shinylive/ artifact | |
# ===================================================== | |
- name: Upload _shinylive/ artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "_shinylive/" | |
# ===================================================== | |
# Upload shinylive bundle on release | |
# ===================================================== | |
# Ensure that if the version in package.json is "0.0.5", then release tag | |
# is "v0.0.5". | |
- name: Check that version number matches release tag | |
if: github.event_name == 'release' | |
run: | | |
if [ "${{github.ref}}" != refs/tags/v`node -p "require('./package.json').version"` ]; then | |
echo Version in package.json, prepended with \"refs/tags/v\", is \"v`node -p "require('./package.json').version"`\", which does not match git tag \"${{github.ref}}\". | |
exit 1 | |
fi | |
- name: Build shinylive deployment bundle for release | |
if: github.event_name == 'release' | |
run: | | |
make dist | |
- name: Upload shinylive bundle to release | |
if: github.event_name == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "dist/*.tar.gz" | |
tag: ${{ github.ref }} | |
file_glob: true | |
overwrite: true | |
# ===================================================== | |
# Deploy GitHub Pages site | |
# ===================================================== | |
deploy_gh_pages: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |