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 github action release workflow #646

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
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
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 }}