-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (41 loc) · 1.45 KB
/
update-examples.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
name: 'Update examples'
on:
push:
tags: [ '*' ]
workflow_dispatch:
inputs:
ref:
description: 'Branch or tag'
required: true
defaults:
run:
shell: bash
jobs:
update-examples:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install -r .github/scripts/requirements.txt
- name: 'Get versions'
run: |
new="${{ inputs.ref || github.ref_name }}"
echo "Deleting '$new' in case it's alpha to stable bump." \
"Git v:refname doesn't handle Maven version qualifiers correctly."
git tag -d "$new"
old="$(git tag --sort=-v:refname | head -n 1)"
echo "OLD_VERSION=$old" | tee -a $GITHUB_ENV
echo "NEW_VERSION=$new" | tee -a $GITHUB_ENV
- name: 'Update version in all files'
run: ./.github/scripts/replace_string.py ./ "$OLD_VERSION" "$NEW_VERSION"
- name: 'Create PR'
uses: peter-evans/create-pull-request@v7
with:
base: 'main'
branch: "replace-${{ env.OLD_VERSION }}-${{ env.NEW_VERSION }}"
title: "Bump examples and badges to ${{ env.NEW_VERSION }}"
author: "github-actions <[email protected]>"
committer: "github-actions <[email protected]>"
body: "Bump the version in examples and badges from ${{ env.OLD_VERSION }} to ${{ env.NEW_VERSION }}."