Use outputs

This commit is contained in:
Ben Sarmiento
2023-12-01 01:46:54 +01:00
parent 2fff33af77
commit db2387faf5
2 changed files with 20 additions and 6 deletions

View File

@@ -26,6 +26,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Generate build variables
id: prep
run: |
echo "built_at=$(date +%Y-%m-%dT%H:%M:%S)" >> $GITHUB_OUTPUT
echo "go_version=$(go version | cut -d ' ' -f 3)" >> $GITHUB_OUTPUT
echo "git_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Cross-compile with xgo
uses: crazy-max/ghaction-xgo@v3
with:
@@ -40,9 +47,9 @@ jobs:
race: false
ldflags: >
-s -w
-X 'github.com/debridmediamanager/zurg/internal.BuiltAt=$(date +%Y-%m-%dT%H:%M:%S)'
-X 'github.com/debridmediamanager/zurg/internal.GoVersion=$(go version | cut -d " " -f 3)'
-X 'github.com/debridmediamanager/zurg/internal.GitCommit=$(git rev-parse HEAD)'
-X 'github.com/debridmediamanager/zurg/internal.BuiltAt=${{ steps.prep.outputs.built_at }}'
-X 'github.com/debridmediamanager/zurg/internal.GoVersion=${{ steps.prep.outputs.go_version }}'
-X 'github.com/debridmediamanager/zurg/internal.GitCommit=${{ steps.prep.outputs.git_commit }}'
-X 'github.com/debridmediamanager/zurg/internal.Version=${{ steps.version.outputs.version }}'
buildmode: default
trimpath: true