Skip to content

Commit 98cb3f6

Browse files
authored
Merge pull request #43 from snow-actions/release-workflows
Release workflows
2 parents b1ad042 + 064a7dc commit 98cb3f6

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [ closed ]
6+
7+
jobs:
8+
release:
9+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
env:
13+
GH_TOKEN: ${{ github.token }}
14+
GH_REPO: ${{ github.repository }}
15+
RELEASE_BRANCH: ${{ github.event.pull_request.head.ref }}
16+
17+
steps:
18+
- name: Create release
19+
run: |
20+
version=${RELEASE_BRANCH#release/}
21+
gh release create ${version} --title ${version} --generate-notes --discussion-category Announcements

.github/workflows/version-up.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Version up
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
semantic:
7+
description: Semantic versioning
8+
required: true
9+
default: patch
10+
type: choice
11+
options:
12+
- major
13+
- minor
14+
- patch
15+
16+
jobs:
17+
version-up:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Package
24+
run: |
25+
npm ci
26+
npm run package
27+
- name: Version up
28+
id: version
29+
run: |
30+
set -x
31+
version=$(npm --no-git-tag-version version $SEMANTIC)
32+
echo "::set-output name=version::${version}"
33+
sed -i -e "s|${GITHUB_REPOSITORY}@v[.0-9]\+|${GITHUB_REPOSITORY}@${version}|g" README.md
34+
git diff
35+
env:
36+
SEMANTIC: ${{ github.event.inputs.semantic }}
37+
- uses: snow-actions/[email protected]
38+
- uses: actions/create-github-app-token@v1
39+
id: app-token
40+
with:
41+
app-id: ${{ secrets.APP_ID }}
42+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
43+
- name: Commit & PR
44+
run: |
45+
set -x
46+
branch="release/${VERSION}"
47+
git switch -c ${branch}
48+
git add .
49+
git commit -m "${VERSION}"
50+
git push origin ${branch}
51+
gh pr create --base ${GITHUB_REF_NAME} --head ${branch} --assignee ${GITHUB_ACTOR} --title ${VERSION} --body ''
52+
env:
53+
VERSION: ${{ steps.version.outputs.version }}
54+
GH_TOKEN: ${{ steps.app-token.outputs.token }}

0 commit comments

Comments
 (0)