Skip to content

[GHA TEST] Change version back #18

[GHA TEST] Change version back

[GHA TEST] Change version back #18

name: Check Version
on:
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: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Get current and previous versions
id: version_check
run: |
git fetch origin ${{ github.event.before }} ${{ github.event.after }}
BEFORE_VERSION=$(git show ${{ github.event.before }}:package.json | jq -r '.version')
AFTER_VERSION=$(git show ${{ github.event.after }}:package.json | jq -r '.version')
echo "Before version: $BEFORE_VERSION"
echo "After version: $AFTER_VERSION"
echo "before_version=$BEFORE_VERSION" >> $GITHUB_OUTPUT
echo "after_version=$AFTER_VERSION" >> $GITHUB_OUTPUT
if [ -n "$BEFORE_VERSION" ]; then
echo "Version changed from $BEFORE_VERSION to $AFTER_VERSION."
echo "version_changed=true" >> $GITHUB_OUTPUT
else
echo "Version did not change."
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
release:
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.version_changed == 'true'
steps:
- name: Release
run: |
echo "TODO: Make a release as version `${{ needs.check-version.outputs.after_version }}`."