Skip to content

Commit

Permalink
Merge branch 'develop' into ITEM-141_revoir_l'affichage_du_footer
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-maraval authored Aug 19, 2024
2 parents 0d0c870 + e2bce7c commit ec88590
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,38 @@ on:
description: 'Version de la release (semver)'
required: true
default: 'x.x.x'
snapshotVersion:
description: 'Version de la Snapshot (semver)'
required: true
default: 'x.x.x-SNAPSHOT'

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: "debug info"
run: |
echo ${{github}}
- name: "Calculate versions"
id: calculate-version
run: |
releaseVersion=${{ inputs.releaseVersion }}
# Séparer les parties de la version
major=$(echo "${releaseVersion}" | cut -d. -f1)
minor=$(echo "${releaseVersion}" | cut -d. -f2)
patch=$(echo "${releaseVersion}" | cut -d. -f3)
# Incrémenter la partie patch
patch=$((patch + 1))
# Reconstituer la version snapshot
snapshotVersion="${major}.${minor}.${patch}-SNAPSHOT"
echo "${snapshotVersion}"
echo "snapshotVersion=${snapshotVersion}" >> $GITHUB_OUTPUT
echo "content :"
cat "$GITHUB_OUTPUT"
- name: 'Checkout source code'
uses: 'actions/checkout@v3'
with:
fetch-depth: '0' # to get all the tags locally
# https://stackoverflow.com/questions/67550727/push-event-doesnt-trigger-workflow-on-push-paths-github-actions
token: ${{ secrets.TOKEN_GITHUB_FOR_GITHUB_ACTION }}


- name: 'Verify release is created only on "main" or "master" git branch'
run: |
CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
Expand All @@ -33,10 +47,10 @@ jobs:
- name: 'Verify version is semver formatted (X.X.X)'
env:
NEW_TAG: ${{ github.event.inputs.releaseVersion }}
NEW_TAG_SNAPSHOT: ${{ github.event.inputs.snapshotVersion }}
NEW_SNAPSHOT_TAG: ${{ steps.calculate-version.outputs.snapshotVersion }}
run: |
echo $NEW_TAG | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'
echo $NEW_TAG_SNAPSHOT | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$'
echo $NEW_SNAPSHOT_TAG | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$'
- name: 'Verify version is not already used as a git tag'
env:
NEW_TAG: ${{ github.event.inputs.releaseVersion }}
Expand All @@ -46,7 +60,7 @@ jobs:
- name: 'Generate the new version (patch few files + git tag)'
env:
NEW_TAG: ${{ github.event.inputs.releaseVersion }}
NEW_TAG_SNAPSHOT: ${{ github.event.inputs.snapshotVersion }}
NEW_SNAPSHOT_TAG: ${{ steps.calculate-version.outputs.snapshotVersion }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB_FOR_GITHUB_ACTION }}
run: |
# préparation de la release qui va :
Expand Down Expand Up @@ -78,15 +92,15 @@ jobs:
git push
# switch version to snapshot version
echo -e "setns x=http://maven.apache.org/POM/4.0.0\ncd /x:project/x:version\nset $NEW_TAG_SNAPSHOT\nsave" \
echo -e "setns x=http://maven.apache.org/POM/4.0.0\ncd /x:project/x:version\nset $NEW_SNAPSHOT_TAG\nsave" \
| xmllint --shell ./pom.xml
for POM_FILE in $(ls */pom.xml)
do
echo -e "setns x=http://maven.apache.org/POM/4.0.0\ncd /x:project/x:parent/x:version\nset $NEW_TAG_SNAPSHOT\nsave" \
echo -e "setns x=http://maven.apache.org/POM/4.0.0\ncd /x:project/x:parent/x:version\nset $NEW_SNAPSHOT_TAG\nsave" \
| xmllint --shell $POM_FILE
done
git add .
git commit -m "Version $NEW_TAG_SNAPSHOT [skip ci]"
git commit -m "Version $NEW_SNAPSHOT_TAG [skip ci]"
git push
- name: 'Create the github release'
Expand Down
3 changes: 1 addition & 2 deletions batch/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>itembackoffice</artifactId>
<groupId>fr.abes.item</groupId>
Expand Down

0 comments on commit ec88590

Please sign in to comment.