Skip to content

Commit

Permalink
ci: create release (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
bathienle authored Jan 25, 2024
1 parent 7fc097a commit 2457f60
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
changelog:
categories:
- title: ✅ Added
labels:
- docs
- feature
- title: 🔁 Changed
labels:
- chore
- dependencies
- enhancement
- perf
- refactor
- style
- title: 🛑 Deprecated
labels:
- deprecated
- title: 🔧 Fixed
labels:
- bug
- title: 🗑️ Removed
labels:
- removed
- title: 🛡️ Security
labels:
- security
- title: 🧪 Test
labels:
- test
exclude:
labels:
- duplicate
- good first issue
- invalid
- question
- wontfix
41 changes: 41 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create release

on:
push:
tags:
- "*.*.*"

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Prerelease check
run: |
if [[ ${{ github.ref_name }} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "prerelease=false" >> $GITHUB_ENV
else
echo "prerelease=true" >> $GITHUB_ENV
fi
- name: Create release
uses: actions/github-script@v6
env:
name: ${{ github.ref_name }}
prerelease: ${{ env.prerelease }}
with:
script: |
try {
const response = await github.rest.repos.createRelease({
generate_release_notes: true,
name: process.env.name,
owner: context.repo.owner,
prerelease: process.env.prerelease === "true",
repo: context.repo.repo,
tag_name: process.env.name,
});
return response.data.id;
} catch (error) {
core.setFailed(error.message);
}

0 comments on commit 2457f60

Please sign in to comment.