mirror of
https://github.com/Xevion/HATray.git
synced 2025-12-05 23:15:09 -06:00
ci: add 'version' task to taskfile, use in build.yml
This commit is contained in:
19
.github/workflows/build.yml
vendored
19
.github/workflows/build.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: sudo apt-get install libgtk-3-dev libayatana-appindicator3-dev
|
run: sudo apt-get install -y libgtk-3-dev libayatana-appindicator3-dev
|
||||||
|
|
||||||
- name: Build Linux Binary
|
- name: Build Linux Binary
|
||||||
run: task build
|
run: task build
|
||||||
@@ -36,9 +36,8 @@ jobs:
|
|||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')
|
echo "VERSION=$(task version --silent)" >> $GITHUB_OUTPUT
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
echo "BINARY_NAME=HATray-linux-amd64-$(task version --silent)" >> $GITHUB_OUTPUT
|
||||||
echo "BINARY_NAME=HATray-linux-amd64-$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Rename Linux Binary with Version
|
- name: Rename Linux Binary with Version
|
||||||
run: mv bin/HATray ${{ steps.get_version.outputs.BINARY_NAME }}
|
run: mv bin/HATray ${{ steps.get_version.outputs.BINARY_NAME }}
|
||||||
@@ -76,16 +75,8 @@ jobs:
|
|||||||
id: get_version_win
|
id: get_version_win
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
# Extract the version using git tags, fallback to 'unknown' if it fails
|
echo "VERSION=$(task version --silent)" >> $env:GITHUB_OUTPUT
|
||||||
try {
|
echo "BINARY_NAME=HATray-windows-amd64-$(task version --silent)" >> $env:GITHUB_OUTPUT
|
||||||
$version = git describe --tags --abbrev=0 2>$null
|
|
||||||
if ([string]::IsNullOrWhiteSpace($version)) { $version = 'unknown' }
|
|
||||||
} catch {
|
|
||||||
$version = 'unknown'
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "VERSION=$($version.Trim())" >> $env:GITHUB_OUTPUT
|
|
||||||
echo "BINARY_NAME=HATray-windows-amd64-$($version.Trim())" >> $env:GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Rename Windows Binary with Version
|
- name: Rename Windows Binary with Version
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|||||||
13
Taskfile.yml
13
Taskfile.yml
@@ -1,8 +1,8 @@
|
|||||||
version: '3'
|
version: "3"
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
APP_NAME: 'HATray'
|
APP_NAME: "HATray"
|
||||||
VERSION: '0.0.1'
|
VERSION: "0.0.1"
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
build:
|
build:
|
||||||
@@ -43,4 +43,9 @@ tasks:
|
|||||||
deps: [deps, fmt, vet, test, build]
|
deps: [deps, fmt, vet, test, build]
|
||||||
cmds:
|
cmds:
|
||||||
- echo "Development workflow complete"
|
- echo "Development workflow complete"
|
||||||
- echo "Run 'task windows:run' to start the application"
|
- echo "Run 'task windows:run' to start the application"
|
||||||
|
|
||||||
|
version:
|
||||||
|
desc: "Show the version of the application"
|
||||||
|
cmds:
|
||||||
|
- git describe --tags --abbrev=0 2>/dev/null || echo "unknown"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ version: "3"
|
|||||||
vars:
|
vars:
|
||||||
BINARY_NAME: "{{.APP_NAME}}.exe"
|
BINARY_NAME: "{{.APP_NAME}}.exe"
|
||||||
VERSION:
|
VERSION:
|
||||||
sh: powershell -Command "try { agit describe --tags --abbrev=0 } catch { 'unknown' }"
|
sh: powershell -Command "try { git describe --tags --abbrev=0 } catch { 'unknown' }"
|
||||||
COMMIT:
|
COMMIT:
|
||||||
sh: git rev-parse --short HEAD
|
sh: git rev-parse --short HEAD
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user