-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(repo): add Actions workflows to manage versions and releases wit…
…h Pipeline
- Loading branch information
1 parent
b2430dd
commit 3aa2db5
Showing
4 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Init Nx Cloud CE Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
TARGET_BRANCH: | ||
description: 'TARGET_BRANCH to checkout (e.g. main or release-2.5)' | ||
required: true | ||
type: string | ||
|
||
TARGET_VERSION: | ||
description: 'TARGET_VERSION to build artifacts (e.g. 2.5.0-rc1) Note: the `v` prefix is not used' | ||
required: true | ||
type: string | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
prepare-release: | ||
permissions: | ||
contents: write # for peter-evans/create-pull-request to create branch | ||
pull-requests: write # for peter-evans/create-pull-request to create a PR | ||
name: Automatically generate version and artifacts on ${{ inputs.TARGET_BRANCH }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: ${{ inputs.TARGET_BRANCH }} | ||
|
||
- name: Check if TARGET_VERSION is well formed. | ||
run: | | ||
set -xue | ||
# Target version must not contain 'v' prefix | ||
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then | ||
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
- name: Create VERSION information | ||
run: | | ||
set -ue | ||
echo "Bumping version from $(cat VERSION) to ${{ inputs.TARGET_VERSION }}" | ||
echo "${{ inputs.TARGET_VERSION }}" > VERSION | ||
- name: Generate new set of artifacts | ||
run: | | ||
set -ue | ||
find . -type f -name 'build.gradle.kts' -exec sed -i -E 's/version = "([0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?)"/version = "${{ inputs.TARGET_VERSION }}"/g' {} + | ||
find . -type f -name 'Chart.yaml' -exec sed -i -E 's/version: "[0-9]+\.[0-9]+\.[0-9]"/version: "${{ inputs.TARGET_VERSION }}"/g' {} + | ||
find . -type f -name 'Chart.yaml' -exec sed -i -E 's/appVersion: "[0-9]+\.[0-9]+\.[0-9]"/version: "${{ inputs.TARGET_VERSION }}"/g' {} + | ||
git diff | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | ||
with: | ||
commit-message: "Bump version to ${{ inputs.TARGET_VERSION }}" | ||
title: "Bump version to ${{ inputs.TARGET_VERSION }} on ${{ inputs.TARGET_BRANCH }} branch" | ||
body: Updating VERSION and artifacts to ${{ inputs.TARGET_VERSION }} | ||
branch: update-version | ||
branch-suffix: random | ||
signoff: true | ||
labels: release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Publish Nx Cloud CE Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
#on: | ||
# push: | ||
# tags: | ||
# - 'v*' | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
retag-oci-images: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write # for creating OIDC tokens for signing. | ||
packages: write # used to push images to `ghcr.io` if used. | ||
steps: | ||
- name: 'Set up skopeo' | ||
uses: warjiang/setup-skopeo@71776e03c10d767c04af8924fe5a67763f9b3d34 # v0.1.3 | ||
with: | ||
version: latest | ||
|
||
- name: Extract tag and commit SHA | ||
id: vars | ||
run: | | ||
echo "TAG=v0.0.1" >> $GITHUB_ENV | ||
SHORT_SHA=$(git rev-parse --short $GITHUB_SHA) | ||
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV | ||
- name: 'Sync images' | ||
run: | | ||
skopeo --version | ||
echo "short sha ${{ env.SHORT_SHA }}" | ||
echo "tag ${{ env.TAG }}" | ||
# skopeo copy --dest-creds \ | ||
# ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} \ | ||
# docker://ghcr.io/clementguillot/nx-cloud-ce-server:${{ env.SHORT_SHA }} \ | ||
# docker://ghcr.io/clementguillot/nx-cloud-ce-server:${{ env.TAG }} | ||
|
||
#publish helm chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.0 |