Skip to content

Commit

Permalink
Merge pull request #43 from snow-actions/release-workflows
Browse files Browse the repository at this point in the history
Release workflows
  • Loading branch information
SnowCait authored Dec 28, 2024
2 parents b1ad042 + 064a7dc commit 98cb3f6
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
pull_request:
types: [ closed ]

jobs:
release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
timeout-minutes: 5
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_BRANCH: ${{ github.event.pull_request.head.ref }}

steps:
- name: Create release
run: |
version=${RELEASE_BRANCH#release/}
gh release create ${version} --title ${version} --generate-notes --discussion-category Announcements
54 changes: 54 additions & 0 deletions .github/workflows/version-up.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Version up

on:
workflow_dispatch:
inputs:
semantic:
description: Semantic versioning
required: true
default: patch
type: choice
options:
- major
- minor
- patch

jobs:
version-up:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- name: Package
run: |
npm ci
npm run package
- name: Version up
id: version
run: |
set -x
version=$(npm --no-git-tag-version version $SEMANTIC)
echo "::set-output name=version::${version}"
sed -i -e "s|${GITHUB_REPOSITORY}@v[.0-9]\+|${GITHUB_REPOSITORY}@${version}|g" README.md
git diff
env:
SEMANTIC: ${{ github.event.inputs.semantic }}
- uses: snow-actions/[email protected]
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Commit & PR
run: |
set -x
branch="release/${VERSION}"
git switch -c ${branch}
git add .
git commit -m "${VERSION}"
git push origin ${branch}
gh pr create --base ${GITHUB_REF_NAME} --head ${branch} --assignee ${GITHUB_ACTOR} --title ${VERSION} --body ''
env:
VERSION: ${{ steps.version.outputs.version }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

0 comments on commit 98cb3f6

Please sign in to comment.