Update UI #24
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 UI | |
on: | |
workflow_dispatch: | |
inputs: | |
uninstall: | |
description: UI versions to uninstall (space delimited) | |
required: false | |
install: | |
description: UI versions to install (space delimited) | |
required: false | |
base-branch: | |
description: Branch to open PR against | |
required: false | |
default: 'master' | |
jobs: | |
ui: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
HEAD_BRANCH: update-ui-${{ github.run_number }} | |
steps: | |
- name: checkout cylc-uiserver | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.base-branch }} | |
- name: Configure git | |
uses: cylc/release-actions/configure-git@v1 | |
- name: Create Branch | |
run: | | |
git checkout -b "${HEAD_BRANCH}" | |
- name: uninstall | |
run: | | |
for version in ${{ inputs.uninstall }}; do | |
git rm -rf "cylc/uiserver/ui/${version}" | |
git commit -m "ui: uninstall ${version}" | |
done | |
- name: install | |
env: | |
RELEASES: https://github.com/cylc/cylc-ui/releases/download | |
run: | | |
for version in ${{ inputs.install }}; do | |
wget \ | |
"$RELEASES/${version}/cylc-ui-${version}-dist.zip" \ | |
-O "${version}.zip" | |
mkdir -p "cylc/uiserver/ui/${version}/" | |
unzip "${version}.zip" -d "cylc/uiserver/ui/${version}/" | |
git add "cylc/uiserver/ui/${version}/" | |
git commit -m "ui: install ${version}" | |
done | |
- name: Add to changelog | |
if: inputs.install | |
run: | | |
python3 -m pip install -q towncrier | |
towncrier create +.ui-version.md --content "Updated cylc-ui to ${{ inputs.install }}" | |
git add changes.d | |
git commit --amend --no-edit | |
- name: push | |
run: | | |
git push origin "$HEAD_BRANCH" | |
- name: Create pull request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BASE_BRANCH: ${{ inputs.base-branch }} | |
TITLE: 'Update UI' | |
BODY: | | |
uninstall: ${{ inputs.uninstall }} | |
install: ${{ inputs.install }} | |
ASSIGNEE: ${{ github.triggering_actor }} | |
run: | | |
gh pr create -R "$GITHUB_REPOSITORY" \ | |
-H "$HEAD_BRANCH" -B "$BASE_BRANCH" -t "$TITLE" -b "$BODY" \ | |
-a "$ASSIGNEE" -r "$ASSIGNEE" |