fix (project): github_workspace #4
Workflow file for this run
This file contains hidden or 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 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: | | |
| # Path to the version data file | |
| DSFR_VERSION_FILE="${GITHUB_WORKSPACE}/package.json" | |
| # Parse the file and extract the version | |
| DSFR_VERSION=$(cat DSFR_VERSION_FILE | 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 |