Skip to content

Commit

Permalink
Merge pull request #20 from raskyld/raskyld-patch-1
Browse files Browse the repository at this point in the history
Start CD release pipeline
  • Loading branch information
raskyld authored Oct 23, 2023
2 parents 0eb477c + f0906fb commit c5b0a37
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/go-ossf-slsa3-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release
on:
workflow_dispatch:
release:
types: [created]

permissions: read-all

jobs:
args:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ldflags.outputs.version }}
steps:
- id: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- id: ldflags
run: |
echo "version=$(git describe --tags --always --dirty | cut -c2-)" >> "$GITHUB_OUTPUT"
build:
permissions:
id-token: write # To sign.
contents: write # To upload release assets.
actions: read # To read workflow path.
needs: args
strategy:
matrix:
os:
- linux
- darwin
arch:
- arm64
- amd64
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
go-version: 1.21
evaluated-envs: "VERSION:${{needs.args.outputs.version}}, TARGET_OS:${{matrix.os}}, TARGET_ARCH:${{matrix.arch}}"
22 changes: 22 additions & 0 deletions slsa-goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Version for this file.
version: 1

# (Optional) List of env variables used during compilation.
env:
- GO111MODULE=on
- CGO_ENABLED=0

# The OS to compile for. `GOOS` env variable will be set to this value.
goos: "{{ .Env.TARGET_OS }}"

# The architecture to compile for. `GOARCH` env variable will be set to this value.
goarch: "{{ .Env.TARGET_ARCH }}"

# Binary output name.
# {{ .Os }} will be replaced by goos field in the config file.
# {{ .Arch }} will be replaced by goarch field in the config file.
binary: binary-{{ .Os }}-{{ .Arch }}

# (Optional) ldflags generated dynamically in the workflow, and set as the `evaluated-envs` input variables in the workflow.
ldflags:
- "-X main.Version={{ .Env.VERSION }}"

0 comments on commit c5b0a37

Please sign in to comment.