Skip to content

Commit

Permalink
release action
Browse files Browse the repository at this point in the history
  • Loading branch information
jagreenwood committed Sep 25, 2024
1 parent 76b52b5 commit a1e27ec
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options
changelog:
exclude:
labels:
- ci
- ignore-for-release
authors:
- github-actions
- octocat
categories:
- title: Breaking Changes 🛠
labels:
- semver/major
- breaking-change
- title: New Features 🎉
labels:
- semver/minor
- enhancement
- title: Bug Fixes 🐛
labels:
- semver/patch
- bug
- title: Other Changes
labels:
- "*"
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: Type of release
type: choice
required: true
options:
- patch
- minor
- major

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Get latest release version
id: get_current_version
uses: actions/github-script@v7
with:
script: |
const { data: { tag_name } } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
return tag_name
- name: Bump version
id: bump
uses: Mobelux/bump-version-action@v1
with:
release-type: ${{ inputs.release_type }}
version: ${{ steps.get_current_version.outputs.result }}

- name: Push tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.bump.outputs.version }}',
sha: context.sha
})
- name: Create release
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: '${{ steps.bump.outputs.version }}',
generate_release_notes: true,
draft: false,
prerelease: false
})

0 comments on commit a1e27ec

Please sign in to comment.