From 8e6a365a5452bfe2fcfaf44fee731f0e6b5e11b9 Mon Sep 17 00:00:00 2001 From: jsetton Date: Wed, 10 Jan 2024 09:51:56 -0500 Subject: [PATCH] Add github action release workflow Signed-off-by: jsetton --- .github/release-drafter.yml | 30 +++++++++++++++++ .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..8c361428 --- /dev/null +++ b/.github/release-drafter.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..3598e958 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 bot@openhab.org + 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 }}