Skip to content

Commit

Permalink
cd: Update version number in script after each release
Browse files Browse the repository at this point in the history
  • Loading branch information
itislu committed Apr 21, 2024
1 parent 39d2d7b commit 2a6e91a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*.*.*'

env:
VERSION:

permissions:
contents: write
actions: write
Expand All @@ -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:
Expand All @@ -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
4 changes: 2 additions & 2 deletions 42free.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

current_version="0.0.2"
current_version="v0.0.2"

default_args=(\
"$HOME/.cache" \
Expand Down Expand Up @@ -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}."

Expand Down

0 comments on commit 2a6e91a

Please sign in to comment.