-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (63 loc) · 2.67 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
type:
description: 'New version type [major | minor | patch]'
required: true
default: 'patch'
jobs:
bumpVersion:
runs-on: ubuntu-24.04
steps:
- run: |
echo "New version type: ${{ github.event.inputs.type }}"
- name: Setup checkout
uses: actions/checkout@v4
with:
# Use a PAT to ensure that
# commits are authored with a specific user
# workflow run are triggered after git push
token: ${{ secrets.GH_RELEASE_TOKEN }}
- name: Config git
run: |
git config --local user.email "[email protected]"
git config --local user.name "process-analytics-bot"
git config pull.rebase true
- name: Checkout main
run: git checkout main && git pull --tags
- name: Generate new version
id: release_version
uses: zwaldowski/semver-release-action@v4
with:
dry_run: true
bump: ${{ inputs.type }}
prefix: v
github_token: ${{ secrets.GH_RELEASE_TOKEN }}
- name: Update with the release version
run: |
CURRENT_VERSION=$(grep Version DESCRIPTION | sed 's/Version: \(.*\).9000/\1/g')
sed -i -E "s/$CURRENT_VERSION/${{ steps.release_version.outputs.version }}/g" index.md
sed -i -E "s/$CURRENT_VERSION/${{ steps.release_version.outputs.version }}/g" README.md
sed -i -E "s/$CURRENT_VERSION.9000/${{ steps.release_version.outputs.version }}/g" cran-comments.md
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}/g' DESCRIPTION
- name: Commit with the release version
run: |
git add index.md
git add README.md
git add cran-comments.md
git add DESCRIPTION
git commit -m "chore(release): set the release version to ${{ steps.release_version.outputs.version }}"
- name: Tag ${{ steps.release_version.outputs.version }}
run: |
git tag -a ${{ steps.release_version.outputs.version_tag }} -m "chore(release): ${{ steps.release_version.outputs.version }}"
- name: Update with the development version
run: |-
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}.9000/g' DESCRIPTION
- name: Commit with the development version
run: |
git add DESCRIPTION
git commit -m "chore(release): set the development version to ${{ steps.release_version.outputs.version }}.9000"
- name: Push commits and tags
run: |
git push && git push --tags