File tree Expand file tree Collapse file tree 3 files changed +119
-0
lines changed Expand file tree Collapse file tree 3 files changed +119
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Create Release Tag
3
+
4
+ permissions :
5
+ contents : read
6
+ pull-requests : read
7
+
8
+ on :
9
+ pull_request :
10
+ types : ['closed']
11
+ branches :
12
+ - ' release-prep/**'
13
+ paths :
14
+ - ' CHANGELOG.md'
15
+
16
+ concurrency :
17
+ group : ' create-release-${{ github.head_ref }}'
18
+ cancel-in-progress : true
19
+
20
+ jobs :
21
+ build :
22
+ name : Create Release Tag
23
+ runs-on : ubuntu-latest
24
+ steps :
25
+ - name : Get branch name
26
+ run : echo "BRANCH_NAME=${GITHUB_REF#refs/heads/release-prep/}" >> $GITHUB_ENV
27
+ - name : Create tag
28
+ uses : actions/github-script@v5
29
+ with :
30
+ script : |
31
+ echo "Creating tag v${{ env.BRANCH_NAME }}"
32
+ github.rest.git.createRef({
33
+ owner: context.repo.owner,
34
+ repo: context.repo.repo,
35
+ ref: 'refs/tags/v${{ env.BRANCH_NAME }}',
36
+ sha: context.sha
37
+ })
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Release
3
+
4
+ on :
5
+ push :
6
+ tags :
7
+ - ' v[0-9]+.[0-9]+.[0-9]+*'
8
+
9
+ permissions :
10
+ contents : write
11
+
12
+ jobs :
13
+ release-notes :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ with :
18
+ fetch-depth : 0
19
+ - name : Generate Release Notes
20
+ run : sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt
21
+ - uses : actions/upload-artifact@v4
22
+ with :
23
+ name : release-notes
24
+ path : release-notes.txt
25
+ retention-days : 1
26
+
27
+ # TODO: enable when GPG key will be imported
28
+ # terraform-provider-release:
29
+ # name: Terraform Provider Release
30
+ # needs: [release-notes]
31
+ # uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@v5.0.0
32
+ # secrets:
33
+ # gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
34
+ # with:
35
+ # setup-go-version-file: 'go.mod'
36
+ # release-notes: true
37
+ # goreleaser-release-args: --timeout 2h --verbose --parallelism 4
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Uncomment to print commands instead of executing them
4
+ # debug="echo "
5
+
6
+ TRUNK=" main"
7
+ DATE=" $( date ' +%B %d, %Y' ) "
8
+
9
+ BRANCH=" $( git rev-parse --abbrev-ref HEAD) "
10
+ if [[ " ${BRANCH} " != " ${TRUNK} " ]]; then
11
+ echo " Release must be prepped on \` ${TRUNK} \` branch." >&2
12
+ exit 1
13
+ fi
14
+
15
+ echo " Preparing changelog for release..."
16
+
17
+ if [[ ! -f CHANGELOG.md ]]; then
18
+ echo " Error: CHANGELOG.md not found."
19
+ exit 2
20
+ fi
21
+
22
+ RELEASE=" $( sed -r -n ' s/^## v?([0-9.]+) \(Unreleased\)/\1/p' CHANGELOG.md) "
23
+ if [[ " ${RELEASE} " == " " ]]; then
24
+ echo " Error: could not determine next release in CHANGELOG.md" >&2
25
+ exit 3
26
+ fi
27
+
28
+
29
+ # Ensure latest changes are checked out
30
+ ( set -x; ${debug} git pull --rebase origin " ${TRUNK} )" )
31
+
32
+ # Set the date for the latest release
33
+ ( set -x; ${debug} sed -r " s/^(## \[[0-9.]+\]) \(Unreleased\)/\1 (${DATE} )/i" CHANGELOG.md )
34
+
35
+ echo " Preparing release v${RELEASE} ..."
36
+
37
+ (
38
+ set -x
39
+ ${debug} git checkout -b " release-prep/${RELEASE} "
40
+ ${debug} git add CHANGELOG.md
41
+ ${debug} git commit -m " Prepare release v${RELEASE} "
42
+ ${debug} git push origin"
43
+ )
44
+
45
+
You can’t perform that action at this time.
0 commit comments