Skip to content

Commit

Permalink
Add github action release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <[email protected]>
  • Loading branch information
jsetton committed Jan 10, 2024
1 parent d4f30cc commit 8e6a365
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name-template: $RESOLVED_VERSION
tag-template: $RESOLVED_VERSION

categories:
- title: 💥 Breaking
labels:
- breaking
- title: 🚀 Features
labels:
- enhancement
- title: 🐛 Bug Fixes
labels:
- bug
- title: 📄 Documentation
labels:
- documentation
- title: 🧰 Maintenance
labels:
- maintenance
- title: 📦 Dependency Updates
labels:
- dependencies
collapse-after: 1

template: |
## What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
workflow_dispatch:
inputs:
release-type:
description: Release Type
required: true
default: patch
type: choice
options: [ major, minor, patch, premajor, preminor, prepatch, prerelease ]

jobs:
pkg-update:
name: Package Version Update
runs-on: ubuntu-latest

permissions:
contents: write

outputs:
version: ${{ steps.pkg-version.outputs.version }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Bump package version
id: pkg-version
run: echo "version=$(npm version ${{ github.event.inputs.release-type }} --no-git-tag-version --preid=beta --tag-version-prefix=)" >> $GITHUB_OUTPUT
working-directory: lambda

- name: Commit and push changes
run: |
git config user.name openhab-bot
git config user.email [email protected]
git commit -a -m "Bump version to ${{ steps.pkg-version.outputs.version }}"
git push
publish:
name: Release Publishing
runs-on: ubuntu-latest
needs: pkg-update

permissions:
contents: write
pull-requests: write

steps:
- name: Draft and publish a new release
uses: release-drafter/release-drafter@v5
with:
version: ${{ needs.pkg-update.outputs.version }}
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8e6a365

Please sign in to comment.