-
Notifications
You must be signed in to change notification settings - Fork 18
82 lines (72 loc) · 2.37 KB
/
update_ui.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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"