Skip to content

Commit

Permalink
Merge pull request #12 from narugit/feature/add_github_actions_to_cre…
Browse files Browse the repository at this point in the history
…ate_release

feat: Create workflow to create release
  • Loading branch information
narugit authored Aug 6, 2023
2 parents 8847a08 + e688ecb commit e633039
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Create release

on:
workflow_dispatch:
inputs:
version:
required: true
description: Ex. 1.2.0

permissions:
contents: write

jobs:
create-release:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TZ: 'Asia/Tokyo'
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Audit version
run: |
expect_version=$(sed -n 's/.*kVersion = "\(.*\)";/\1/p' smctemp.h)
input_version=${{ github.event.inputs.version }}
if [[ "$expect_version" != "$input_version" ]]; then
echo "ERROR: Version is mismatched. Expected version: $expect_version"
exit 1
fi
- name: Set version and create tag
run: |
VERSION=${{ github.event.inputs.version }}
echo "Creating tag $VERSION"
git config --global user.name 'narugit'
git config --global user.email 'narusens@gmail.com'
git tag -a $VERSION -m "Version $VERSION"
git push origin $VERSION
- name: Create release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false

0 comments on commit e633039

Please sign in to comment.