Skip to content

Commit a7e6d4e

Browse files
authored
refactor: change version handling (mainsail-crew#296)
* refactor: change version handling Signed-off-by: Stephan Wendel <me@stephanwe.de> --------- Signed-off-by: Stephan Wendel <me@stephanwe.de>
1 parent bb12882 commit a7e6d4e

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

.github/workflows/Release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ jobs:
2323
id: current-version
2424
shell: bash
2525
run: |
26-
version=$(cat ./src/version)
27-
echo "version=${version}" >> $GITHUB_OUTPUT
26+
source ./config/default
27+
echo "version=${DIST_VERSION}" >> $GITHUB_OUTPUT
2828
2929
- name: Push version number
3030
if: steps.current-version.outputs.version != github.event.inputs.version
3131
shell: bash
3232
run: |
33-
echo ${{ github.event.inputs.version }} > ./src/version
33+
sed -i "s|^DIST_VERSION.*|DIST_VERSION=\"${{ github.event.inputs.version }}\"|" ./config/default
3434
3535
- name: git add & commit & push
3636
if: steps.current-version.outputs.version != github.event.inputs.version
3737
uses: EndBug/add-and-commit@v9
3838
with:
39-
add: "./src/version"
39+
add: "./config/default"
4040
default_author: github_actions
4141
message: "chore: push version number to v${{ github.event.inputs.version }}"
4242
push: true

config/default

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@
22
# Shebang for better file detection
33
# shellcheck enable=require-variable-braces
44

5-
get_version() {
6-
local ver
7-
ver="$(realpath "$( dirname -- "${BASH_SOURCE[0]}")"/../src/version)"
8-
9-
if [ -f "${ver}" ]; then
10-
cat "${ver}"
11-
return
12-
fi
13-
14-
ver="$(realpath "$( dirname -- "${BASH_SOURCE[0]}")"/version)"
15-
cat "${ver}"
16-
}
17-
185
get_img_name() {
196
local -a types
207
types=(zip 7z xz)
@@ -29,7 +16,7 @@ get_img_name() {
2916
fi
3017
}
3118

32-
DIST_VERSION="$(get_version)"
19+
DIST_VERSION="1.3.2"
3320
BASE_ZIP_IMG="$(get_img_name)"
3421
DIST_NAME="MainsailOS"
3522

src/version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)