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

Fixup and split backporting actions #137

Merged
merged 7 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish Backport GitHub Pages
# This workflow can be used to backport a release from a tag to the gh-pages branch
# This is useful when you want to backport a release to the gh-pages branch
# Most likely you will want to check and update BASE_REF and VERSIONS env variables
# It is hardcoded for versions v2.1.0
# @BASE_REF: the tag you want to backport from
# @VERSIONS: the versions you want to backport to

name: Publish Backport GitHub Pages

on:
workflow_dispatch:

Expand Down Expand Up @@ -54,10 +55,10 @@ jobs:
git config user.email "<>"
git status
git remote --verbose
git branch -D gh-pages-backport || true
git checkout -b gh-pages-backport
git branch -D gh-pages-backport-2.1 || true
git checkout -b gh-pages-backport-2.1
git add .
git commit -m "Update gh-pages"
git push origin gh-pages-backport -f
echo "Pushed build changes to gh-pages-backport"
echo "REMEMBER TO CREATE A PR FROM gh-pages-backport TO gh-pages"
git push origin gh-pages-backport-2.1 -f
echo "Pushed build changes to gh-pages-backport-2.1"
echo "REMEMBER TO CREATE A PR FROM gh-pages-backport-2.1 TO gh-pages"
63 changes: 63 additions & 0 deletions .github/workflows/publish-gh-pages-backport-pre-2.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Backport GitHub Pages
# This workflow can be used to backport a release from a tag to the gh-pages branch
# This is useful when you want to backport a release to the gh-pages branch
# It is hardcoded for versions <= v2.0.1 as they are incomaptible with the v2.1.0 gh-pages
# @BASE_REF: the tag you want to backport from
# @VERSIONS: the versions you want to backport to

on:
workflow_dispatch:

env:
BASE_REF: v2.0.1-with-backported-fixes
VERSIONS: v1.0.0,v1.1.0,v1.2.1,v1.2.2,v2.0.0,v2.0.1,v2.1.0
witmicko marked this conversation as resolved.
Show resolved Hide resolved
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'

- 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-2.0.1 || true
git checkout -b gh-pages-backport-2.0.1
git add .
git commit -m "Update gh-pages"
git push origin gh-pages-backport-2.0.1 -f
echo "Pushed build changes to gh-pages-backport-2.0.1"
echo "REMEMBER TO CREATE A PR FROM gh-pages-backport-2.0.1 TO gh-pages"