Skip to content

Commit

Permalink
Add manual release workflow (#301)
Browse files Browse the repository at this point in the history
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: ben <ben@prologe.io>
  • Loading branch information
1 parent 79d670e commit c95cfef
Show file tree
Hide file tree
Showing 2 changed files with 8,209 additions and 6,531 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Manual Plugin Release

on:
workflow_dispatch:
inputs:
increment:
description: 'Version increment type'
required: true
type: choice
options:
- patch
- minor
- major
default: 'patch'

jobs:
check_release:
runs-on: ubuntu-latest
outputs:
is_releasing: ${{ steps.check.outputs.is_releasing }}
steps:
- id: check
name: Check for running release workflows
run: |
# Get running workflows
running=$(gh api /repos/${{ github.repository }}/actions/runs \
--jq '.workflow_runs[] | select(.status=="in_progress" and (.name=="Release Obsidian Plugin" or .name=="Manual Plugin Release")) | .id' \
| wc -l)
# If any release workflows are running (besides this one), set output
if [ "$running" -gt "1" ]; then
echo "is_releasing=true" >> $GITHUB_OUTPUT
echo "::error::A release is already in progress. Please wait for it to complete."
exit 1
else
echo "is_releasing=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
needs: check_release
if: needs.check_release.outputs.is_releasing != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Increment version
run: |
cd packages/plugin
pnpm version ${{ github.event.inputs.increment }} --no-git-tag-version
- name: Update manifest and versions
run: |
cd packages/plugin
pnpm run version
- name: Create and push tag
run: |
cd packages/plugin
node commit.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit c95cfef

Please sign in to comment.