[GHA TEST] Change version back #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Version | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- app/package.json | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Get current and previous versions | |
id: version_check | |
run: | | |
CURRENT_VERSION=$(jq -r '.version' app/package.json) | |
BASE_COMMIT=$(git merge-base HEAD origin/main) | |
PREVIOUS_VERSION="" | |
for commit in $(git rev-list $BASE_COMMIT..HEAD); do | |
VERSION=$(git show $commit:app/package.json | jq -r '.version') | |
if [ "$VERSION" != "$CURRENT_VERSION" ]; then | |
PREVIOUS_VERSION=$VERSION | |
break | |
fi | |
done | |
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
echo "previous_version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT | |
if [ -n "$PREVIOUS_VERSION" ]; then | |
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION." | |
else | |
echo "Version did not change." | |
fi | |
release: | |
runs-on: ubuntu-latest | |
needs: check-version | |
if: needs.check-version.outputs.previous_version != '' | |
steps: | |
- name: Release | |
run: | | |
echo "TODO: Make a release as version `${{ needs.check-version.outputs.current_version }}`." |