Update #3171
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: Update | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
schedule: | |
- cron: '0 * * * *' # every hour | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
update_pages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token | |
fetch-depth: 0 # otherwise, will fail to push refs to dest repo | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install -r requirements.txt | |
- name: Install npm dependencies | |
run: | | |
npm install | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Prepare gh-pages | |
run: | | |
# empty contents | |
rm -f -r ./gh-pages/* | |
# no jekyll | |
touch ./gh-pages/.nojekyll | |
# copy dependencies | |
cp -f ./node_modules/plotly.js/dist/plotly.min.js ./gh-pages/plotly.js | |
- name: Convert notebook | |
env: | |
DASHBOARD_AUR_REPOS: sunshine,sunshine-bin,sunshine-git | |
CODECOV_TOKEN: ${{ secrets.CODECOV_API_TOKEN }} | |
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }} | |
DISCORD_INVITE: ${{ secrets.DISCORD_INVITE }} | |
FACEBOOK_GROUP_ID: ${{ secrets.FACEBOOK_GROUP_ID }} | |
FACEBOOK_PAGE_ID: ${{ secrets.FACEBOOK_PAGE_ID }} | |
FACEBOOK_TOKEN: ${{ secrets.FACEBOOK_ACCESS_TOKEN }} | |
GITHUB_REPOSITORY_OWNER: ${{ secrets.GH_ORG_NAME }} | |
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
PATREON_CAMPAIGN_ID: 6131567 | |
READTHEDOCS_TOKEN: ${{ secrets.READTHEDOCS_TOKEN }} | |
run: | | |
jupyter nbconvert \ | |
--debug \ | |
--config=./jupyter_nbconvert_config.py \ | |
--execute \ | |
--no-input \ | |
--to=html \ | |
--output-dir=./gh-pages \ | |
--output=index \ | |
./notebook/dashboard.ipynb | |
- name: Archive gh-pages | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} | |
shell: bash | |
run: | | |
7z \ | |
"-xr!*.git*" \ | |
a "./gh-pages.zip" "./gh-pages" | |
- name: Upload Artifacts | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gh-pages | |
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` | |
path: | | |
${{ github.workspace }}/gh-pages.zip | |
- name: Deploy to gh-pages | |
if: >- | |
(github.event_name == 'push' && github.ref == 'refs/heads/master') || | |
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | |
uses: actions-js/[email protected] | |
with: | |
github_token: ${{ secrets.GH_BOT_TOKEN }} | |
author_email: ${{ secrets.GH_BOT_EMAIL }} | |
author_name: ${{ secrets.GH_BOT_NAME }} | |
directory: gh-pages | |
branch: gh-pages | |
force: false | |
message: automatic-update-${{ steps.date.outputs.date }} |