Skip to content

Commit

Permalink
ci: On workflow_dispatch, update py-shiny module and deploy to gh-pag…
Browse files Browse the repository at this point in the history
…es (#122)

* Add `submodules-pull-shiny` target for Makefile

* Add script to manually commit to main with the latest py-shiny version on GitHub

* debug

* update permissions to token

* Pull latest posit-dev/py-shiny@9570af4

* Revert "Pull latest posit-dev/py-shiny@9570af4"

This reverts commit ad155d9.

* Add workflow_run trigger to main job (that deploys to gh-pages)

* Pull latest posit-dev/py-shiny@9570af4

* Revert "Pull latest posit-dev/py-shiny@9570af4"

This reverts commit 133d07a.

* Update test branch to `main`

* Use `setup-python@v5` to avoid warning in GHA
  • Loading branch information
schloerke committed Apr 2, 2024
1 parent c3eece9 commit c7f1a71
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ on:
branches: [main]
release:
types: [published]

workflow_run:
workflows: [Update py-shiny submodule]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -22,7 +25,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -66,7 +69,6 @@ jobs:
# path: playwright-report/
# retention-days: 30


# =====================================================
# Publish to AWS for shinylive.io
# =====================================================
Expand All @@ -90,7 +92,6 @@ jobs:
aws s3 sync _shinylive s3://shinylive.io --delete
aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
# =====================================================
# Upload _shinylive/ artifact
# =====================================================
Expand All @@ -100,7 +101,6 @@ jobs:
with:
path: "_shinylive/"


# =====================================================
# Publish to shinylive.io
# =====================================================
Expand All @@ -119,7 +119,6 @@ jobs:
# deployment.
command: pages publish _shinylive/ --project-name=shinylive --commit-dirty=true --branch=main


# =====================================================
# Upload shinylive bundle on release
# =====================================================
Expand Down Expand Up @@ -148,7 +147,6 @@ jobs:
file_glob: true
overwrite: true


# =====================================================
# Deploy GitHub Pages site
# =====================================================
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/update_shiny.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update py-shiny submodule

on:
workflow_dispatch:

jobs:
update-shiny:
name: Update py-shiny submodule
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Check out submodules
run: |
make submodules
- name: Pull latest py-shiny
run: |
make submodules-pull
- name: Build shinylive
run: |
make all
- name: Set up git within GHA
uses: actions4git/setup-git@v1

- name: Commit and push changes
run: |
PY_SHINY_SHA=$(git -C packages/py-shiny rev-parse --short HEAD)
git add packages/py-shiny shinylive_lock.json && \
git commit --message "Pull latest posit-dev/py-shiny@$PY_SHINY_SHA" && \
git push origin HEAD:main
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ submodules:
## Pull latest changes in git submodules
submodules-pull:
git submodule update --recursive --remote
submodules-pull-shiny:
git submodule update --remote packages/py-shiny


## Build everything _except_ the shinylive.tar.gz distribution file
Expand Down

0 comments on commit c7f1a71

Please sign in to comment.