File tree Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : patch_docs
2
+ on :
3
+ push :
4
+ tags :
5
+ - ' v[0-9]+.[0-9]+.[1-9]+' # run this workflow when a new patch version is published
6
+
7
+ permissions :
8
+ contents : write
9
+ pull-requests : write
10
+
11
+ jobs :
12
+ patch-docs :
13
+ runs-on : ubuntu-22.04
14
+ steps :
15
+ - name : Harden Runner
16
+ uses : step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
17
+ with :
18
+ egress-policy : audit
19
+
20
+ - name : Set release version and target branch for vNext
21
+ if : github.event_name == 'push'
22
+ run : |
23
+ TAG="$(echo "${{ github.ref }}" | tr -d 'refs/tags/v')"
24
+ MAJOR_VERSION="$(echo "${TAG}" | cut -d '.' -f1)"
25
+ echo "MAJOR_VERSION=${MAJOR_VERSION}" >> ${GITHUB_ENV}
26
+ MINOR_VERSION="$(echo "${TAG}" | cut -d '.' -f2)"
27
+ echo "MINOR_VERSION=${MINOR_VERSION}" >> ${GITHUB_ENV}
28
+ PATCH_VERSION="$(echo "${TAG}" | cut -d '.' -f3)"
29
+ echo "PATCH_VERSION=${PATCH_VERSION}" >> ${GITHUB_ENV}
30
+ echo "TAG=${TAG}" >> ${GITHUB_ENV}
31
+
32
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
33
+ with :
34
+ fetch-depth : 0
35
+
36
+ - name : Create release branch if needed # patched docs are always being merged to the master branch
37
+ run : |
38
+ git checkout master
39
+
40
+ - name : Create patch version docs
41
+ run : make patch-version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG} OLDVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.$((PATCH_VERSION-1))
42
+
43
+ - name : Create release pull request
44
+ uses : peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
45
+ with :
46
+ commit-message : " chore: Patch docs for ${{ env.TAG }} release"
47
+ title : " chore: Patch docs for ${{ env.TAG }} release"
48
+ branch : " patch-docs-${{ env.TAG }}"
49
+ base : " master"
50
+ signoff : true
51
+ labels : |
52
+ release-pr
53
+ ${{ github.event.inputs.release_version }}
54
+
Original file line number Diff line number Diff line change 41
41
echo "NEWVERSION=v${MAJOR_VERSION}.$((MINOR_VERSION+1)).0-beta.0" >> ${GITHUB_ENV}
42
42
# pre-release is always being merged to the master branch
43
43
echo "TARGET_BRANCH=master" >> ${GITHUB_ENV}
44
+ echo "TAG=${TAG}" >> ${GITHUB_ENV}
44
45
45
46
- name : Set release version and target branch from input
46
47
if : github.event_name == 'workflow_dispatch'
49
50
echo "${NEWVERSION}" | grep -E '^v[0-9]+\.[0-9]+\.[0-9](-(beta|rc)\.[0-9]+)?$' || (echo "release_version should be in the format vX.Y.Z, vX.Y.Z-beta.A, or vX.Y.Z-rc.B" && exit 1)
50
51
51
52
echo "NEWVERSION=${NEWVERSION}" >> ${GITHUB_ENV}
53
+ echo "TAG=${NEWVERSION}" >> ${GITHUB_ENV}
52
54
MAJOR_VERSION="$(echo "${NEWVERSION}" | cut -d '.' -f1 | tr -d 'v')"
53
55
MINOR_VERSION="$(echo "${NEWVERSION}" | cut -d '.' -f2)"
54
56
75
77
- run : make release-manifest promote-staging-manifest
76
78
77
79
- if : github.event_name == 'push'
78
- run : make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x
80
+ run : make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG}
79
81
80
82
- name : Create release pull request
81
83
uses : peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0
Original file line number Diff line number Diff line change @@ -475,7 +475,6 @@ release-manifest:
475
475
@sed -i " s/tag: $( VERSION) /tag: ${NEWVERSION} /" ./cmd/build/helmify/static/values.yaml
476
476
@sed -i ' s/Current release version: `$(VERSION)`/Current release version: `' " ${NEWVERSION} " ' `/' ./cmd/build/helmify/static/README.md
477
477
@sed -i -e ' s/^VERSION := $(VERSION)/VERSION := ${NEWVERSION}/' ./Makefile
478
- @sed -i ' s/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/master\/deploy\/gatekeeper\.yaml.*/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${NEWVERSION}\/deploy\/gatekeeper\.yaml/' ./website/docs/install.md
479
478
export
480
479
$(MAKE ) manifests
481
480
@@ -488,6 +487,11 @@ version-docs:
488
487
-u $(shell id -u) :$(shell id -g) \
489
488
node:${NODE_VERSION} \
490
489
sh -c " yarn install --frozen-lockfile && yarn run docusaurus docs:version ${NEWVERSION} "
490
+ @sed -i ' s/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/master\/deploy\/gatekeeper\.yaml.*/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${TAG}\/deploy\/gatekeeper\.yaml/' ./website/versioned_docs/version-${NEWVERSION} /install.md
491
+
492
+ .PHONY : patch-version-docs
493
+ patch-version-docs :
494
+ @sed -i ' s/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${OLDVERSION}\/deploy\/gatekeeper\.yaml.*/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${TAG}\/deploy\/gatekeeper\.yaml/' ./website/versioned_docs/version-${NEWVERSION} /install.md
491
495
492
496
promote-staging-manifest :
493
497
@rm -rf deploy
You can’t perform that action at this time.
0 commit comments