Skip to content

fix (project): package.json path #5

fix (project): package.json path

fix (project): package.json path #5

name: "Check project version"
on: [push]
# pull_request:
# branches:
# - main
jobs:
version-check:
name: "Check project version doesn't already exists."
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: parse
name: "Extract version number from package.json file."
run: |
# Parse package.json file and extract the version
DSFR_VERSION=$(cat ./package.json | jq .version)
# Send the version to the output
echo "dsfr-project-version=$DSFR_VERSION" >> $GITHUB_OUTPUT
- id: version-check
name: "Check if a tag matching the version doesn't already exists."
run: |
# Get the version from the previous step
VERSION=${{ steps.parse.outputs.dsfr-project-version }}
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "A tag aleady exists for this version, please update the package.json file to a new version.";
exit 1;
fi