From 9a05f383d8680231c7c0178db3f719150ca1fe98 Mon Sep 17 00:00:00 2001 From: Adrian Popescu Date: Mon, 18 Dec 2023 15:47:58 +0200 Subject: [PATCH] [GitActions][Pack] Improvements --- .github/workflows/pack.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index 00e24f1..8324620 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -23,7 +23,7 @@ jobs: steps: - id: check run: | - echo "push_packages=${{ (github.event_name == 'push' && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags'))) || (github.event_name == 'workflow_dispatch') }}" >> $GITHUB_OUTPUT + echo "push_packages=${{ (github.event_name == 'push' && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags'))) || (github.event_name == 'workflow_dispatch') }}" >> $GITHUB_ENV pack: if: ${{ needs.check.outputs.push_packages == 'true' }} @@ -31,24 +31,23 @@ jobs: steps: - name: Determine version run: | - echo "VERSION = $(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV + else + echo "VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV + fi echo "$GITHUB_ENV" - name: 'Validate SemVer' - if: ${{ github.event_name == 'workflow_dispatch' }} run: | - VERSION=${{ github.event.inputs.version }} if [[ ! "$VERSION" =~ ^([0-9]+\.){2}[0-9]+$ ]]; then echo "The version does not match the SemVer format (X.Y.Z). Please provide a valid version." exit 1 - else - echo "VERSION=$VERSION" >> $GITHUB_ENV fi - name: 'Print version' - if: ${{ github.event_name == 'workflow_dispatch' }} run: | - echo 'Version: ${{ github.event.inputs.version }}' + echo "$VERSION" - name: Checkout uses: actions/checkout@v4