Skip to content

Commit

Permalink
add set-version pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
t83714 committed Oct 8, 2023
1 parent 74608e7 commit 63e7d39
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: set-version

run-name: Set version ${{ inputs.version }} on ${{ github.ref_name }}

on:
workflow_dispatch:
inputs:
version:
description: "Please input the new version number. e.g. `v2.0.0-alpha.0` with leading `v`"
required: true
type: string

jobs:
log-the-inputs:
runs-on: ubuntu-latest
steps:
- name: Version validation
env:
SELECTED_VERSION: ${{ inputs.version }}
run: |
SEMVER_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
[[ "${SELECTED_VERSION}" =~ $SEMVER_REGEX ]] || { echo "Invalid version number '$SELECTED_VERSION'. Should be e.g. 'v2.0.0-alpha.0' with leading 'v'." ; exit 1; }
- name: Set helm to v3.12.3
shell: bash
run: |
sudo rm /usr/local/bin/helm
sudo curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > /tmp/helm.sh
sudo chmod +x /tmp/helm.sh
sudo /tmp/helm.sh --version v3.12.3
helm version
- uses: actions/checkout@v3

- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install Utilities
run: yarn install

- name: Setup Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set version
env:
SELECTED_VERSION: ${{ inputs.version }}
run: |
VERSION_NUM=$(echo ${SELECTED_VERSION} | cut -b 2-)
yarn version --new-version ${VERSION_NUM}
git push

0 comments on commit 63e7d39

Please sign in to comment.