summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-08-16 14:48:49 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-08-17 12:36:25 +0200
commit9757fa79ee9e94d60f521269c675df16c33b79b0 (patch)
tree266e6fc74380104d8622b0aef56ae01ad42965f4
parent950d06ad5b54abfc3f0d4dffb6b4b890b029e9e8 (diff)
downloadqutebrowser-9757fa79ee9e94d60f521269c675df16c33b79b0.tar.gz
qutebrowser-9757fa79ee9e94d60f521269c675df16c33b79b0.zip
ci: Use GitHub Script to get release branch
By default, we only get a narrow checkout, so we don't know about any other branches. Use the GitHub API and some JS to get the release branch instead.
-rw-r--r--.github/workflows/release.yml35
1 files changed, 32 insertions, 3 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 213078730..9b963bc9e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,6 +30,35 @@ jobs:
outputs:
version: ${{ steps.bump.outputs.version }}
steps:
+ - name: Find release branch
+ uses: actions/github-script@v6
+ id: find-branch
+ with:
+ script: |
+ if (context.payload.inputs.release_type != 'patch') {
+ return 'main';
+ }
+ const branches = await github.paginate(github.rest.repos.listBranches, {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ });
+ const branch_names = branches.map(branch => branch.name);
+ console.log(`branches: ${branch_names}`);
+ const release_branches = branch_names.filter(branch => branch.match(/^v\d+\.\d+\.x$/));
+ if (release_branches.length === 0) {
+ core.setFailed('No release branch found!');
+ return '';
+ }
+ console.log(`release_branches: ${release_branches}`);
+ // Get newest release branch (biggest version number)
+ const sorted = release_branches.sort(
+ function (a, b) {
+ return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
+ }
+ );
+ console.log(`sorted: ${sorted}`);
+ return sorted.at(-1);
+ result-encoding: string
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
@@ -46,9 +75,9 @@ jobs:
git config --global user.name "qutebrowser bot"
git config --global user.email "bot@qutebrowser.org"
- name: Switch to release branch
- if: "${{ github.event.inputs.release_type }} == 'patch'"
- run: |
- git checkout "$(git branch --format='%(refname:short)' --list 'v*.*.x' | sort -V | tail -n1)"
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.find-branch.outputs.result }}
# FIXME set up GPG for signed tag
- name: Bump version
id: bump