-
Notifications
You must be signed in to change notification settings - Fork 236
47 lines (45 loc) · 1.63 KB
/
new-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: New Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
type: string
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get-version
run: |
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Set git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Change version
if: steps.get-version.outputs.version != ''
run: |
TEMP_FILE=$(mktemp)
jq --arg v "${{ steps.get-version.outputs.version }}" '.version = $v' package.json > $TEMP_FILE
cp $TEMP_FILE package.json
git add .
git commit -m "${{ steps.get-version.outputs.version }}"
- name: Get commit msg
id: get-commit-msg
run: |
if [[ -z "${{ steps.get-version.outputs.version }}" ]]; then
echo "title-release=Release ref $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
else
echo "title-release=Release version ${{ steps.get-version.outputs.version }} $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
fi
- name: Create PR
run: |
git status
git push origin HEAD:actions/new-release --force
gh pr create --base $(git rev-parse --abbrev-ref HEAD) --head actions/new-release --title '${{ steps.get-commit-msg.outputs.title-release }}' --body '' --label release
env:
GH_TOKEN: ${{ github.token }}