-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (77 loc) · 3.13 KB
/
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
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
87
88
89
90
name: Create release PR
run-name: Create release PR for new ${{ github.event.inputs.version }} version
on:
workflow_dispatch:
inputs:
version:
required: true
type: choice
description: "What type of release is this"
options:
- "major"
- "minor"
- "patch"
jobs:
create-release-pr:
name: Create release PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
new_version: ""
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Setup Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
cache-dependency-path: ${{ github.workspace }}/src/go.sum
- name: Check for Changes to the Changelog
id: diff
if: true
run: |
NEW_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION)
LAST_CHANGELOG_VERSION=$(./.github/workflow_scripts/get-latest-changlog-version.sh)
if [ "$NEW_VERSION" != "$LAST_CHANGELOG_VERSION" ]; then
echo "Changelog not updated for version $NEW_VERSION lastest version is $LAST_CHANGELOG_VERSION"
exit 1
fi
- name: Bump version and push
run: |
git config --global user.email "[email protected]"
git config --global user.name "cjlapao"
NEW_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION)
echo "$NEW_VERSION" > ./VERSION
sed -i "/^version:/c\version: \"$NEW_VERSION\"" ./helm/Chart.yaml
sed -i "/^appVersion:/c\appVersion: \"$NEW_VERSION\"" ./helm/Chart.yaml
sed -i "/^\tver =/c\\\tver = \"$NEW_VERSION\"" ./src/main.go
sed -i "/^\/\/ @version/c\\// @version $NEW_VERSION" ./src/main.go
git checkout -b release/"$NEW_VERSION"
go install github.com/swaggo/swag/cmd/swag@latest
cd src
go mod tidy
swag fmt
swag init -g main.go
cd ..
./.github/workflow_scripts/generate-blog-records.sh
make build-helm-chart
git add VERSION /docs/charts/* ./docs/_posts/* ./src/* ./helm/Chart.yaml ./badges/*
git commit -m "Release extension version $NEW_VERSION"
git push --set-upstream origin release/$NEW_VERSION
echo "new_version=$NEW_VERSION" >> "$GITHUB_ENV"
- name: Create PR
run: |
LAST_PR=$(gh pr list --repo ${{ github.repository }} --limit 1 --state merged --search "Release version" --json number | jq -r '.[0].number')
./.github/workflow_scripts/generate-release-notes.sh ${{ github.repository }} "$LAST_PR" ${{ env.new_version }}
gh pr create \
--title "Release version ${{ env.new_version }}" \
--body-file releasenotes.md \
--base main \
--head release/${{ env.new_version }}
gh pr edit --add-label release-request
env:
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}