Skip to content

Commit

Permalink
ci: pointing to correct version of install yaml (#980)
Browse files Browse the repository at this point in the history
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
  • Loading branch information
JaydipGabani authored Feb 12, 2024
1 parent d62940b commit b40637f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 3 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/patch-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: patch_docs
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[1-9]+' # run this workflow when a new patch version is published

permissions:
contents: write
pull-requests: write

jobs:
patch-docs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

- name: Set release version and target branch for vNext
if: github.event_name == 'push'
run: |
TAG="$(echo "${{ github.ref }}" | tr -d 'refs/tags/v')"
MAJOR_VERSION="$(echo "${TAG}" | cut -d '.' -f1)"
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> ${GITHUB_ENV}
MINOR_VERSION="$(echo "${TAG}" | cut -d '.' -f2)"
echo "MINOR_VERSION=${MINOR_VERSION}" >> ${GITHUB_ENV}
PATCH_VERSION="$(echo "${TAG}" | cut -d '.' -f3)"
echo "PATCH_VERSION=${PATCH_VERSION}" >> ${GITHUB_ENV}
echo "TAG=${TAG}" >> ${GITHUB_ENV}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Create release branch if needed # patched docs are always being merged to the main branch
run: |
git checkout main
- name: Create patch version docs
run: make patch-version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG} OLDVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.$((PATCH_VERSION-1))

- name: Create release pull request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
commit-message: "chore: Patch docs for ${{ env.TAG }} release"
title: "chore: Patch docs for ${{ env.TAG }} release"
branch: "patch-docs-${{ env.TAG }}"
base: "main"
signoff: true
labels: |
release-pr
${{ github.event.inputs.release_version }}
4 changes: 3 additions & 1 deletion .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
echo "NEWVERSION=v${MAJOR_VERSION}.$((MINOR_VERSION+1)).0-beta.0" >> ${GITHUB_ENV}
# pre-release is always being merged to the main branch
echo "TARGET_BRANCH=main" >> ${GITHUB_ENV}
echo "TAG=${TAG}" >> ${GITHUB_ENV}
- name: Set release version and target branch from input
if: github.event_name == 'workflow_dispatch'
Expand All @@ -49,6 +50,7 @@ jobs:
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)
echo "NEWVERSION=${NEWVERSION}" >> ${GITHUB_ENV}
echo "TAG=${NEWVERSION}" >> ${GITHUB_ENV}
MAJOR_VERSION="$(echo "${NEWVERSION}" | cut -d '.' -f1 | tr -d 'v')"
MINOR_VERSION="$(echo "${NEWVERSION}" | cut -d '.' -f2)"
Expand All @@ -75,7 +77,7 @@ jobs:
- run: make release-manifest promote-staging-manifest

- if: github.event_name == 'push'
run: make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x
run: make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG}

- name: Create release pull request
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SCANNER_TARBALL_PATH ?=

KUSTOMIZE_VERSION ?= 3.8.9
KUBERNETES_VERSION ?= 1.25.3
NODE_VERSION ?= 16-bullseye-slim
NODE_VERSION ?= 20-bullseye-slim
ENVTEST_K8S_VERSION ?= 1.25
GOLANGCI_LINT_VERSION := 1.43.0

Expand Down Expand Up @@ -341,3 +341,8 @@ version-docs:
$(IDFLAGS) \
node:${NODE_VERSION} \
sh -c "yarn install --frozen-lockfile && yarn run docusaurus docs:version ${NEWVERSION}"
@sed -i 's/https:\/\/raw\.githubusercontent\.com\/eraser-dev\/eraser\/main\/deploy\/eraser\.yaml.*/https:\/\/raw\.githubusercontent\.com\/eraser-dev\/eraser\/${TAG}\/deploy\/eraser\.yaml/' ./docs/versioned_docs/version-${NEWVERSION}/installation.md

.PHONY: patch-version-docs
patch-version-docs:
@sed -i 's/https:\/\/raw\.githubusercontent\.com\/eraser-dev\/eraser\/${OLDVERSION}\/deploy\/eraser\.yaml.*/https:\/\/raw\.githubusercontent\.com\/eraser-dev\/eraser\/${TAG}\/deploy\/eraser\.yaml/' ./docs/versioned_docs/version-${NEWVERSION}/installation.md
2 changes: 1 addition & 1 deletion docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Installation
To install Eraser with the manifest file, run the following command:

```bash
kubectl apply -f https://raw.githubusercontent.com/eraser-dev/eraser/v1.1.0-beta.0/deploy/eraser.yaml
kubectl apply -f https://raw.githubusercontent.com/eraser-dev/eraser/main/deploy/eraser.yaml
```

## Helm
Expand Down

0 comments on commit b40637f

Please sign in to comment.