Skip to content

Commit

Permalink
👷 Improve ci script
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenWaygate committed Sep 12, 2024
1 parent 1f41bfc commit 048e5a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/go-ossf-slsa3-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ jobs:
- id: checkout
uses: actions/checkout@v4
- id: ldflags
shell: bash
run: |
echo "commit-date=$(git log -1 --date='format:%Y-%m-%d/%H.%M.%S' --pretty=%cd)" >> "$GITHUB_OUTPUT"
echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "version=$(git describe --tags --always --dirty | cut -c2-)" >> "$GITHUB_OUTPUT"
echo "tree-state=$(if git diff --quiet; then echo "clean"; else echo "dirty"; fi)" >> "$GITHUB_OUTPUT"
{
echo "commit-date=$(git log -1 --date='format:%Y-%m-%d/%H.%M.%S' --pretty=%cd)"
echo "commit=$(git rev-parse --short HEAD)"
echo "version=$(git describe --tags --always --dirty | cut -c2-)"
echo "tree-state=$(if git diff --quiet; then echo "clean"; else echo "dirty"; fi)"
} >> "$GITHUB_OUTPUT"
# ===================================================================================================================================
# Prerequisite: Create a .slsa-goreleaser.yml in the root directory of your project.
# See format in https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file
Expand All @@ -63,7 +66,7 @@ jobs:
with:
go-version-file: go.mod
config-file: .slsa-goreleaser/${{ matrix.os }}-${{ matrix.arch }}.yml
evaluated-envs: "MODULE_PATH:github.com/${{ github.repository }}, COMMIT_DATE:${{needs.args.outputs.commit-date}}, COMMIT:${{needs.args.outputs.commit}}, VERSION:${{needs.args.outputs.version}}, TREE_STATE:${{needs.args.outputs.tree-state}}"
evaluated-envs: "MODULE_PATH:github.com/${{ github.repository }}, COMMIT_DATE:${{needs.args.outputs.commit-date}}, COMMIT:${{needs.args.outputs.commit}}, VERSION:${{needs.args.outputs.version}}"
# =======================================================================================================
# Optional: For more options, see https://github.com/slsa-framework/slsa-github-generator#golang-projects
# =======================================================================================================
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ qodana.yaml

# Go workspace file
go.work

dist/

0 comments on commit 048e5a9

Please # to comment.