Skip to content

Commit 08c9b26

Browse files
committed
修复环境变量未设置的问题
1 parent 706ed87 commit 08c9b26

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/go-ossf-slsa3-publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ on:
2020
permissions: read-all
2121

2222
jobs:
23+
24+
# Generate ldflags dynamically.
25+
# Optional: only needed for ldflags.
26+
args:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
commit-date: ${{ steps.ldflags.outputs.commit-date }}
30+
commit: ${{ steps.ldflags.outputs.commit }}
31+
version: ${{ steps.ldflags.outputs.version }}
32+
tree-state: ${{ steps.ldflags.outputs.tree-state }}
33+
steps:
34+
- id: checkout
35+
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.3.4
36+
with:
37+
fetch-depth: 0
38+
- id: ldflags
39+
run: |
40+
echo "commit-date=$(git log --date=iso8601-strict -1 --pretty=%ct)" >> "$GITHUB_OUTPUT"
41+
echo "commit=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
42+
echo "version=$(git describe --tags --always --dirty | cut -c2-)" >> "$GITHUB_OUTPUT"
43+
echo "tree-state=$(if git diff --quiet; then echo "clean"; else echo "dirty"; fi)" >> "$GITHUB_OUTPUT"
44+
2345
# ========================================================================================================================================
2446
# Prerequesite: Create a .slsa-goreleaser.yml in the root directory of your project.
2547
# See format in https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file

0 commit comments

Comments
 (0)