Skip to content

Commit

Permalink
Publish as draft when tag has suffix -draft
Browse files Browse the repository at this point in the history
Co-authored-by: Brend Smits <brend.smits@philips.com>
Signed-off-by: Marco Franssen <marco.franssen@philips.com>
  • Loading branch information
marcofranssen and Brend-Smits committed Dec 22, 2021
1 parent c4d4dc4 commit 4233703
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist ${{ (!startsWith(github.ref, 'refs/tags/') && '--snapshot') || '' }}
args: release --rm-dist ${{ (!startsWith(github.ref, 'refs/tags/') && '--snapshot') || '' }} ${{ ((startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-draft')) && '-f .goreleaser.draft.yml') || '' }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
LDFLAGS: ${{ steps.release-vars.outputs.LDFLAGS }}
Expand Down
77 changes: 77 additions & 0 deletions .goreleaser.draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
project_name: slsa-provenance

before:
hooks:
- go mod tidy

env:
- CGO_ENABLED=0

builds:
- id: binary
dir: cmd/slsa-provenance
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
goarm:
- 8
ldflags:
- "{{ .Env.LDFLAGS }}"

archives:
- id: archive
format: tar.gz
replacements:
darwin: macOS
files:
- LICENSE*
- README*
format_overrides:
- goos: windows
format: zip

dockers:
- goos: linux
goarch: amd64
image_templates:
- "philipssoftware/{{ .ProjectName }}:v{{ .Version }}"
- "philipssoftware/{{ .ProjectName }}:{{ .FullCommit }}"
- "ghcr.io/philips-labs/{{ .ProjectName }}:v{{ .Version }}"
- "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .FullCommit }}"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.description={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version=v{{.Version}}"
- "--label=org.opencontainers.image.licenses=MIT"
- "--label=org.opencontainers.image.vendor=Koninklijke Philips N.V."
extra_files:
- "Makefile"
- "go.mod"
- "go.sum"
- "cmd"
- "lib"
checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch

release:
draft: true
prerelease: auto
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ changelog:
- Merge branch

release:
draft: false
prerelease: auto
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ runs:
echo "::set-output name=provenance_args::$(echo "[${args[*]// /,}]")"
- uses: 'docker://ghcr.io/philips-labs/slsa-provenance:v0.4.0'
with:
args: ${{ fromJSON(steps.compose-args.outputs.provenance_args }}
args: ${{ fromJSON(steps.compose-args.outputs.provenance_args) }}

0 comments on commit 4233703

Please sign in to comment.