-
Notifications
You must be signed in to change notification settings - Fork 3
35 lines (30 loc) · 1.08 KB
/
validate-project-version.yml
File metadata and controls
35 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: "Check project version"
on:
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 .version-data.json file."
run: |
# Parse .version-data.json file and extract the version
DSFR_VERSION=$(cat ./.version-data.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 .version-data.json file to a new version.";
exit 1;
fi