diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1137409..ff7c992 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,6 +5,9 @@ on: tags: - 'v*.*.*' +env: + VERSION: + permissions: contents: write actions: write @@ -16,6 +19,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + - name: Release and Upload Asset uses: softprops/action-gh-release@v2 with: @@ -24,3 +32,18 @@ jobs: make_latest: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout main branch + run: | + git checkout main + git pull + + - name: Get the version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" + + - name: Update version number in script + run: | + sed -i "s/^current_version=.*/current_version=\"${{ env.VERSION }}\"/" 42free.sh + git add 42free.sh + git commit -m "bot: Update version number to ${{ env.VERSION }}" + git push origin main diff --git a/42free.sh b/42free.sh index 822c927..14342bc 100755 --- a/42free.sh +++ b/42free.sh @@ -1,6 +1,6 @@ #!/bin/bash -current_version="0.0.2" +current_version="v0.0.2" default_args=(\ "$HOME/.cache" \ @@ -114,7 +114,7 @@ To contribute, report bugs or share improvement ideas, visit ${sty_und}${sty_bri \n" msg_version="\ -${sty_bol}42free v$current_version${sty_res} +${sty_bol}42free $current_version${sty_res} A script made for 42 students to take advantage of symbolic links to free up storage. For more information, visit ${sty_und}${sty_bri_blu}https://github.com/itislu/42free${sty_res}."