DistBranch #190
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: DistBranch | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ "main" ] | |
schedule: | |
- cron: '37 5 * * 5' | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
pull-requests: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
# Any prerequisite steps | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Compress Images | |
id: calibre | |
uses: calibreapp/image-actions@main | |
with: | |
ignorePaths: 'node_modules/**,build' | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
compressOnly: true | |
- name: Create New Pull Request If Needed | |
if: steps.calibre.outputs.markdown != '' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Compressed Images Nightly | |
branch-suffix: timestamp | |
commit-message: Compressed Images | |
body: ${{ steps.calibre.outputs.markdown }} | |
- name: Copy the images | |
run: | | |
rm -rf dist | |
mkdir dist | |
mkdir dist/static | |
cp -r static/icons dist | |
cp -r static/backgrounds dist | |
cp static/site.webmanifest dist/static/site.webmanifest | |
- name: Use Node.js | |
uses: actions/setup-node@main | |
with: | |
node-version: 20.x | |
- name: npm install and build | |
run: | | |
npm install | |
npx npm-force-resolutions | |
npm run build | |
- name: Commit files | |
run: | | |
date > latest.txt | |
git config user.email "action@github.com" | |
git config user.name "github-actions[bot]" | |
git add . | |
git config pull.rebase false | |
git commit -m "Build static website" | |
git pull | |
git push | |
deploypages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload entire repository | |
retention-days: 1 | |
path: 'dist' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |