combined version change and bump-cli workflow
This commit is contained in:
21
.github/workflows/bump-cli.yml
vendored
21
.github/workflows/bump-cli.yml
vendored
@@ -1,6 +1,19 @@
|
||||
name: Bump CLI version
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
option:
|
||||
description: "Option"
|
||||
required: true
|
||||
default: 'replace'
|
||||
type: choice
|
||||
options:
|
||||
- prepend
|
||||
- replace
|
||||
version:
|
||||
description: "Version"
|
||||
required: false
|
||||
type: string
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
@@ -23,10 +36,18 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Bump CLI
|
||||
if: ${{ inputs.option == 'replace' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
scripts/replace-cli-version.sh
|
||||
- name: Prepend another version
|
||||
if: ${{ inputs.option == 'prepend' }}
|
||||
run: |
|
||||
cat supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json
|
||||
mv supported_cli_versions_temp.json supported_cli_versions.json
|
||||
echo "LATEST_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
|
||||
echo "PREVIOUS_VERSION=`jq -r '.[1]' supported_cli_versions.json`" >> $GITHUB_ENV
|
||||
- name: Commit, Push and Open a PR
|
||||
uses: ./.github/actions/create-pr
|
||||
with:
|
||||
|
||||
56
.github/workflows/version-change.yml
vendored
56
.github/workflows/version-change.yml
vendored
@@ -1,56 +0,0 @@
|
||||
name: Version Change
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
option:
|
||||
description: "Option"
|
||||
required: true
|
||||
default: 'append'
|
||||
type: choice
|
||||
options:
|
||||
- append
|
||||
- prepend
|
||||
- remove
|
||||
version:
|
||||
description: "Version"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Remove Version
|
||||
if: ${{ inputs.option == 'remove' }}
|
||||
run: |
|
||||
cat supported_cli_versions.json | jq 'del(.[] | select(. == "${{ inputs.version }}"))' > supported_cli_versions_temp.json
|
||||
- name: Append Version
|
||||
if: ${{ inputs.option == 'append' }}
|
||||
run: |
|
||||
cat supported_cli_versions.json | jq '. += ["${{ inputs.version }}"]' > supported_cli_versions_temp.json
|
||||
- name: Prepend Version
|
||||
if: ${{ inputs.option == 'prepend' }}
|
||||
run: |
|
||||
cat supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json
|
||||
- name: Move temp file to supported_cli_versions.json
|
||||
run: |
|
||||
mv supported_cli_versions_temp.json supported_cli_versions.json
|
||||
- name: Commit, Push and Open a PR
|
||||
uses: ./.github/actions/create-pr
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
base-branch: main
|
||||
head-branch: github-action/version-change
|
||||
commit-message: ${{ inputs.option }} ${{ inputs.version }}
|
||||
title: ${{ inputs.option }} ${{ inputs.version }} from/in supported_cli_versions.json
|
||||
body: >
|
||||
${{ inputs.option }} ${{ inputs.version }} from/in supported_cli_versions.json
|
||||
Reference in New Issue
Block a user