Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ci #16

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release
on:
workflow_dispatch:
inputs:
fragment:
type: choice
description: Semantic version target
options:
- bug
- feature
- major
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install xmlstarlet
- name: checkout
uses: actions/checkout@v3
- name: Get current version
id: get_current_version
run: |
current_version=`\
find . -name "package.xml" -print -quit \
| xargs -n 1 -I{} \
xmlstarlet select --template --value-of "//package/version" {}`
echo "current_version=$current_version" >> $GITHUB_OUTPUT
- name: Bump release version
id: bump_version
uses: christian-draeger/increment-semantic-version@1.0.3
with:
current-version: ${{ steps.get_current_version.outputs.current_version }}
version-fragment: ${{ github.event.inputs.fragment }}
- name: Update package version
run: |
find . -type f -name package.xml | \
xargs -n 1 -I {} \
xmlstarlet edit --inplace --pf \
--update "//package/version" \
--value ${{ steps.bump_version.outputs.next-version }} {}
- name: Commit change
env:
user_name: ${{ github.repository_owner }}
user_email: 40206149+m12watanabe1a@users.noreply.github.com
run: |
git config --local user.name ${{ env.user_name }}
git config --local user.email ${{ env.user_email }}
git switch -c release/${{ steps.bump_version.outputs.next-version }}
git add -A
git commit -m "Version upgrade \
${{ steps.get_current_version.outputs.current_version }} \
-> \
${{ steps.bump_version.outputs.next-version }}"
git push --set-upstream origin release/${{ steps.bump_version.outputs.next-version }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title \
"Release ${{ github.event.inputs.fragment }} upgrade \
${{ steps.get_current_version.outputs.current_version }} \
-> \
${{ steps.bump_version.outputs.next-version }}" \
--base main \
--head release/${{ steps.bump_version.outputs.next-version }} \
-b "Version has been upgraded from \
${{ steps.get_current_version.outputs.current_version }} \
-> \
${{ steps.bump_version.outputs.next-version }}
Check the release page: ${{ github.server_url }}/${{ github.repository }}/releases
"
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
v${{ steps.bump_version.outputs.next-version }} \
-d --generate-notes \
--target release/${{ steps.bump_version.outputs.next-version }}