Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action allowing us to publish backported changes #130

Merged
merged 9 commits into from
Dec 12, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/publish-gh-pages-backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Backport GitHub Pages

on:
workflow_dispatch:

env:
BASE_REF: v2.0.1-from-tag
VERSIONS: v1.0.0,v1.1.0,v1.2.1,v1.2.2
jobs:
publish-to-gh-pages:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ env.BASE_REF }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install npm dependencies
run: yarn --immutable
- name: Run build script
run: |
yarn build:prod

- name: Checkout gh-pages
uses: actions/checkout@v3
with:
ref: 'gh-pages'
path: 'gh-pages'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than checking out this branch as a sub path, have you considered using the same github-actions deploy action we use elsewhere?

uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305

We can use a matrix to iterate over each version target as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried this first but actions were failing when it ran them, will revisit this later tough as it is more elegant solution


- name: prep for pr
run: |
IFS=',' read -ra VERSION_ARRAY <<< ${{ env.VERSIONS }}
for version in "${VERSION_ARRAY[@]}"; do
rm -rf "gh-pages/${version}"/*
cp -r dist/* "gh-pages/${version}/"
done

- name: Commit files
run: |
cd gh-pages
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git status
git remote --verbose
git branch -D gh-pages-backport || true
git checkout -b gh-pages-backport
git add .
git commit -m "Update gh-pages"
git push origin gh-pages-backport -f