Skip to content

change build naming #1981 #2013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
needs: build-and-run-tests
uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml
with:
minor-release: 'none'
# upload artifacts on push action to main only
upload-artifact: ${{ github.event_name == 'push' }}
secrets: inherit
Expand Down
76 changes: 31 additions & 45 deletions .github/workflows/publish-plugin-and-cli-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,23 @@ name: "[M] Plugin and CLI: publish as archives"
on:
workflow_call:
inputs:
minor-release:
type: string
description: "It adds minor release indicator to version."
required: false
default: 'none'
version-postfix:
type: string
description: "It adds postfix (alpha or beta) to version (optional)."
required: false
default: no-postfix
upload-artifact:
type: string
description: "Upload artifacts or not"
required: false
default: false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

workflow_dispatch:
inputs:
minor-release:
type: choice
description: "It adds minor release indicator to version."
required: true
default: 'none'
options:
- 'none'
- '1'
- '2'
- '3'
- '4'
version-postfix:
type: choice
description: "It adds alpha or beta postfix to version."
required: true
default: no-postfix-prod
options:
- no-postfix-prod
- no-postfix
- alpha
- beta
upload-artifact:
type: choice
description: "Upload artifacts or not"
Expand All @@ -50,6 +28,15 @@ on:
options:
- true
- false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

jobs:
publish_plugin_and_cli:
Expand All @@ -65,25 +52,24 @@ jobs:
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
steps:
- uses: actions/checkout@v3
- name: Check out ${{ github.event.inputs.commit_sha }} commit
if: github.event.inputs.commit_sha != ''
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git fetch
git checkout ${{ github.event.inputs.commit_sha }}

# "You can make an environment variable available to any subsequent steps in a workflow job by
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
- name: Set environment variables
- name: Setup custom version
if: ${{ github.event.inputs.custom_version != '' }}
run: |
echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV
- name: Set production version
if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
echo "VERSION=${{ github.event.inputs.custom_version }}" >> $GITHUB_ENV
- name: Setup version
if: ${{ github.event.inputs.custom_version == '' }}
run: |
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
- name: Set version for minor release
if: ${{ github.event.inputs.minor-release != 'none' }}
run: |
echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV
- name: Create version with postfix
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
run:
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF_NAME:0:4}-$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV

- name: Print environment variables
run: printenv

Expand Down