-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 2.19 KB
/
Copy pathbump-version.yml
File metadata and controls
60 lines (53 loc) · 2.19 KB
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
name: Bump version
on:
schedule:
- cron: "0 0 * * 0" # Every Sunday at midnight UTC
workflow_dispatch:
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
app-id: ${{ secrets.CSDA_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.CSDA_RELEASE_BOT_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
token: ${{ steps.app-token.outputs.token }}
- id: check
name: Check if bi-weekly run
run: |
week=$((10#$(date +%V)))
if [ $((week % 2)) -eq 0 ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
- if: steps.check.outputs.should_run == 'true'
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- if: steps.check.outputs.should_run == 'true'
id: bump
name: Update version
run: |
current=$(cat csda-version.txt)
new_version=$(uv run csda-version next-csda-version "$(date +%Y-%m-%d)" "$current")
echo "$new_version" > csda-version.txt
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- if: steps.check.outputs.should_run == 'true'
name: Create pull request
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
branch="bump-version/${{ steps.bump.outputs.new_version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$branch"
git add csda-version.txt
git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }}"
git push -u origin "$branch"
gh pr create \
--title "chore: bump version to ${{ steps.bump.outputs.new_version }}" \
--body "Automated version bump to ${{ steps.bump.outputs.new_version }}"