-
Notifications
You must be signed in to change notification settings - Fork 16
86 lines (81 loc) · 3.46 KB
/
release-drafter.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
#pull_request:
# Only following types are handled by the action, but one can default to all as well
# types: [opened, reopened, synchronize, labeled, unlabeled]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
workflow_dispatch:
permissions:
contents: read
jobs:
Create_PR_for_next_version_and_update_release_draft:
permissions:
contents: write # for release-drafter/release-drafter to create a github release
pull-requests: write # for release-drafter/release-drafter to add label to PR
runs-on: ubuntu-latest
steps:
# First we use release-drafter for calc the next version based on PR labels
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
id: release_drafter
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
with:
config-name: release-drafter.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Now create the PR for next version
- uses: actions/checkout@v3
- name: Make version change
run: |
tag=${{ steps.release_drafter.outputs.tag_name }}
version=$(echo ${{ steps.release_drafter.outputs.tag_name }} | sed 's/^v//')
echo "New version is: $version"
filename=$(find . -name "manifest.json")
echo "My file is: $filename"
#echo "`jq '.version="'${version}'"' $filename`" > $filename
sed -i 's/"version": *"[^"]*"/"version": "'${version}'"/' $filename
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update release version ${{ steps.release_drafter.outputs.tag_name }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: next-release-version
delete-branch: false
title: Update release version to ${{ steps.release_drafter.outputs.tag_name }}
body: |
Automatically updating the next release version based on release-drafter output
labels: |
skip-changelog
# Now create the proper release-draft based on version in the code
- uses: actions/checkout@v3
- name: Get version from file
id: get_version
run: |
filename=$(find . -name "manifest.json")
echo "My file is: $filename"
echo "`jq -r '.version' $filename`"
ver=$(jq -r '.version' $filename)
echo "Version read is: $ver"
echo "::set-output name=version::$ver"
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
id: release_drafter_real
with:
tag: "v${{ steps.get_version.outputs.version }}"
# version: ${{ steps.get_version.outputs.version }}
# tag: "v2.0.1-beta"
# version: "2.0.1-beta"
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}