Skip to content

Commit

Permalink
[GitActions][Pack] Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Popescu committed Dec 18, 2023
1 parent 5022ca0 commit 9a05f38
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,31 @@ 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' }}
runs-on: ubuntu-latest
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
Expand Down

0 comments on commit 9a05f38

Please sign in to comment.