Skip to content

Commit caf87ac

Browse files
committed
add workflow
1 parent 3bebe1f commit caf87ac

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow lets you compile your Go project using a SLSA3 compliant builder.
7+
# This workflow will generate a so-called "provenance" file describing the steps
8+
# that were performed to generate the final binary.
9+
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
10+
# https://github.com/slsa-framework/slsa-github-generator.
11+
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
12+
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
13+
14+
name: SLSA Go releaser
15+
on:
16+
workflow_dispatch:
17+
release:
18+
types: [created]
19+
20+
permissions: read-all
21+
22+
jobs:
23+
# ========================================================================================================================================
24+
# Prerequesite: Create a .slsa-goreleaser.yml in the root directory of your project.
25+
# See format in https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file
26+
#=========================================================================================================================================
27+
build:
28+
permissions:
29+
id-token: write # To sign.
30+
contents: write # To upload release assets.
31+
actions: read # To read workflow path.
32+
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.4.0
33+
with:
34+
go-version: 1.19
35+
# =============================================================================================================
36+
# Optional: For more options, see https://github.com/slsa-framework/slsa-github-generator#golang-projects
37+
# =============================================================================================================
38+

.slsa-goreleaser.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Version for this file.
2+
version: 1
3+
4+
# (Optional) List of env variables used during compilation.
5+
env:
6+
- GO111MODULE=on
7+
- CGO_ENABLED=0
8+
9+
# (Optional) Flags for the compiler.
10+
flags:
11+
- -trimpath
12+
- -tags=netgo
13+
14+
# The OS to compile for. `GOOS` env variable will be set to this value.
15+
goos: linux
16+
17+
# The architecture to compile for. `GOARCH` env variable will be set to this value.
18+
goarch: amd64
19+
20+
# (Optional) Entrypoint to compile.
21+
main: ./cmd/lcode-hub
22+
23+
# (Optional) Working directory. (default: root of the project)
24+
# dir: ./relative/path/to/dir
25+
26+
# Binary output name.
27+
# {{ .Os }} will be replaced by goos field in the config file.
28+
# {{ .Arch }} will be replaced by goarch field in the config file.
29+
binary: binary-{{ .Os }}-{{ .Arch }}
30+
31+
# (Optional) ldflags generated dynamically in the workflow, and set as the `evaluated-envs` input variables in the workflow.
32+
ldflags:
33+
- "-X main.Version={{ .Env.VERSION }}"
34+
- "-X main.Commit={{ .Env.COMMIT }}"
35+
- "-X main.CommitDate={{ .Env.COMMIT_DATE }}"
36+
- "-X main.TreeState={{ .Env.TREE_STATE }}"

0 commit comments

Comments
 (0)