

Add release ci
@91addda372c0802d2ec4b13b0fde7e4d318032af
+++ .github/workflows/release.yaml
... | ... | @@ -0,0 +1,82 @@ |
1 | +name: Release | |
2 | +on: | |
3 | + workflow_dispatch: | |
4 | + inputs: | |
5 | + fragment: | |
6 | + type: choice | |
7 | + description: Semantic version target | |
8 | + options: | |
9 | + - bug | |
10 | + - feature | |
11 | + - major | |
12 | +jobs: | |
13 | + release: | |
14 | + name: Release | |
15 | + runs-on: ubuntu-latest | |
16 | + steps: | |
17 | + - name: Install dependencies | |
18 | + run: | | |
19 | + sudo apt-get update && sudo apt-get install xmlstarlet | |
20 | + - name: checkout | |
21 | + uses: actions/checkout@v3 | |
22 | + - name: Get current version | |
23 | + id: get_current_version | |
24 | + run: | | |
25 | + current_version=`\ | |
26 | + find . -name "package.xml" -print -quit \ | |
27 | + | xargs -n 1 -I{} \ | |
28 | + xmlstarlet select --template --value-of "//package/version" {}` | |
29 | + echo "current_version=$current_version" >> $GITHUB_OUTPUT | |
30 | + - name: Bump release version | |
31 | + id: bump_version | |
32 | + uses: christian-draeger/increment-semantic-version@1.0.3 | |
33 | + with: | |
34 | + current-version: ${{ steps.get_current_version.outputs.current_version }} | |
35 | + version-fragment: ${{ github.event.inputs.fragment }} | |
36 | + - name: Update package version | |
37 | + run: | | |
38 | + find . -type f -name package.xml | \ | |
39 | + xargs -n 1 -I {} \ | |
40 | + xmlstarlet edit --inplace --pf \ | |
41 | + --update "//package/version" \ | |
42 | + --value ${{ steps.bump_version.outputs.next-version }} {} | |
43 | + - name: Commit change | |
44 | + env: | |
45 | + user_name: ${{ github.repository_owner }} | |
46 | + user_email: 40206149+m12watanabe1a@users.noreply.github.com | |
47 | + run: | | |
48 | + git config --local user.name ${{ env.user_name }} | |
49 | + git config --local user.email ${{ env.user_email }} | |
50 | + git switch -c release/${{ steps.bump_version.outputs.next-version }} | |
51 | + git add -A | |
52 | + git commit -m "Version upgrade \ | |
53 | + ${{ steps.get_current_version.outputs.current_version }} \ | |
54 | + -> \ | |
55 | + ${{ steps.bump_version.outputs.next-version }}" | |
56 | + git push --set-upstream origin release/${{ steps.bump_version.outputs.next-version }} | |
57 | + - name: Create Pull Request | |
58 | + env: | |
59 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
60 | + run: | | |
61 | + gh pr create \ | |
62 | + --title \ | |
63 | + "Release ${{ github.event.inputs.fragment }} upgrade \ | |
64 | + ${{ steps.get_current_version.outputs.current_version }} \ | |
65 | + -> \ | |
66 | + ${{ steps.bump_version.outputs.next-version }}" \ | |
67 | + --base main \ | |
68 | + --head release/${{ steps.bump_version.outputs.next-version }} \ | |
69 | + -b "Version has been upgraded from \ | |
70 | + ${{ steps.get_current_version.outputs.current_version }} \ | |
71 | + -> \ | |
72 | + ${{ steps.bump_version.outputs.next-version }} | |
73 | + Check the release page: ${{ github.server_url }}/${{ github.repository }}/releases | |
74 | + " | |
75 | + - name: Create release | |
76 | + env: | |
77 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
78 | + run: | | |
79 | + gh release create \ | |
80 | + v${{ steps.bump_version.outputs.next-version }} \ | |
81 | + -d --generate-notes \ | |
82 | + --target release/${{ steps.bump_version.outputs.next-version }} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?