From 82c4e966eb7e6d38a9964aae0b48bb16c3ba3237 Mon Sep 17 00:00:00 2001 From: Buddy-Lee CELDRAN <44428671+BudNatsu@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:15:04 +0100 Subject: [PATCH] Create create-release.yml --- .github/workflows/create-release.yml | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..e5e959f --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,63 @@ +name: 'Create Release' + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: 'Version de la release (semver)' + required: true + default: 'x.x.x' + +jobs: + create-release: + runs-on: ubuntu-latest + + steps: + - 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 version is semver formatted (X.X.X)' + env: + NEW_TAG: ${{ github.event.inputs.releaseVersion }} + run: | + echo $NEW_TAG | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' + - name: 'Verify version is not already used as a git tag' + env: + NEW_TAG: ${{ github.event.inputs.releaseVersion }} + run: | + [[ "$(git tag --list | grep $NEW_TAG)" == "" ]] && exit 0 || exit 1 + + + + - name: 'Generate the new version (patch few files + git tag)' + env: + NEW_TAG: ${{ github.event.inputs.releaseVersion }} + run: | + # préparation de la release qui va : + # - créer un tag git du numéro de version en question + # - pousser le tout sur le dépôt github + git config --global user.email "github-action@noreply" + git config --global user.name "Github Action" + + echo $NEW_TAG > .version + git add .version + # création du tag + git commit -m "Version $NEW_TAG" + git tag $NEW_TAG + git push origin $NEW_TAG + #git commit --amend -m "Version $NEW_TAG [skip ci]" + #git push + + + + - name: 'Create the github release' + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.event.inputs.releaseVersion }} + generate_release_notes: true + token: ${{ secrets.TOKEN_GITHUB_FOR_GITHUB_ACTION }}