Skip to content

Commit

Permalink
feat: draft release support (#1882)
Browse files Browse the repository at this point in the history
I started with the generic builder and will continue with the others as
well if you accept the solution:

Fixes #1476 

I tried that in osv-scanner project and it worked: 
* Job:
_https://github.com/developer-guy/osv-scanner/actions/runs/4536204956/jobs/7992687991_
* Release:
_https://github.com/developer-guy/osv-scanner/releases/tag/untagged-5bf09e3accd2794d0d10_

PTAL @laurentsimon @asraa @ianlewis

---------

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Ian Lewis <ianlewis@google.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
  • Loading branch information
developer-guy and ianlewis committed Apr 3, 2023
1 parent 9b6d8b5 commit 7edd74b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 42 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/builder_docker-based_slsa3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ on:
required: false
type: string
default: ""
draft-release:
description: "If true, the release is created as a draft. Defaults to false."
required: false
type: boolean
default: false
outputs:
build-outputs-name:
description: "The name of the artifact where the generated artifacts are uploaded to the artifact registry."
Expand Down Expand Up @@ -590,6 +595,7 @@ jobs:
files: |
${{ needs.build.outputs.build-outputs-name }}
${{ needs.provenance.outputs.provenance-name }}
draft: ${{ inputs.draft-release }}

- name: Upload provenance tag name
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
Expand All @@ -600,6 +606,7 @@ jobs:
files: |
${{ needs.build.outputs.build-outputs-name }}/*
${{ needs.provenance.outputs.provenance-name }}
draft: ${{ inputs.draft-release }}

###################################################################
# #
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/builder_go_slsa3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ on:
required: false
type: boolean
default: false
draft-release:
description: "If true, the release is created as a draft. Defaults to false."
required: false
type: boolean
default: false
outputs:
go-binary-name:
description: "The name of the generated binary uploaded to the artifact registry."
Expand Down Expand Up @@ -369,6 +374,7 @@ jobs:
files: |
${{ needs.build-dry.outputs.go-binary-name }}
${{ needs.provenance.outputs.go-provenance-name }}
draft: ${{ inputs.draft-release }}

- name: Upload provenance tag name
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
Expand All @@ -379,3 +385,4 @@ jobs:
files: |
${{ needs.build-dry.outputs.go-binary-name }}
${{ needs.provenance.outputs.go-provenance-name }}
draft: ${{ inputs.draft-release }}
7 changes: 7 additions & 0 deletions .github/workflows/generator_generic_slsa3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ on:
required: false
type: boolean
default: false
draft-release:
description: "If true, the release is created as a draft. Defaults to false."
required: false
type: boolean
default: false
outputs:
release-id:
description: >
Expand Down Expand Up @@ -237,6 +242,7 @@ jobs:
if: inputs.upload-tag-name == ''
id: release-new-tags
with:
draft: ${{ inputs.draft-release }}
files: |
${{ needs.generator.outputs.provenance-name }}
Expand All @@ -245,6 +251,7 @@ jobs:
if: inputs.upload-tag-name != ''
id: release-tag-name
with:
draft: ${{ inputs.draft-release }}
tag_name: "${{ inputs.upload-tag-name }}"
files: |
${{ needs.generator.outputs.provenance-name }}
Expand Down
19 changes: 15 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
- [New Features](#new-features)
- [Generic generator](#generic-generator)
- [New Features](#new-features-1)
- [Container generator](#container-generator)
- [Docker-based generator](#docker-based-generator)
- [New Features](#new-features-2)
- [Container generator](#container-generator)
- [New Features](#new-features-3)
- [Changelog since v1.5.0](#changelog-since-v150)
- [v1.5.0](#v150)
- [Summary of changes](#summary-of-changes-1)
- [Go builder](#go-builder-1)
- [New Features](#new-features-3)
- [Generic generator](#generic-generator-1)
- [New Features](#new-features-4)
- [Container generator](#container-generator-1)
- [Generic generator](#generic-generator-1)
- [New Features](#new-features-5)
- [Container generator](#container-generator-1)
- [New Features](#new-features-6)
- [Changelog since v1.4.0](#changelog-since-v140)
- [v1.4.0](#v140)
- [What's Changed](#whats-changed)
Expand Down Expand Up @@ -82,11 +84,20 @@

- A new [`prerelease`](https://github.com/slsa-framework/slsa-github-generator/blob/v1.6.0/internal/builders/generic/README.md#workflow-inputs) input was added to allow users to create releases marked as prerelease when `upload-assets` is set to `true`.
- A new output `go-provenance-name` added which can be used to retrieve the name of the provenance file generated by the builder.
- A new input `draft-release` was added to allow users to create releases marked as draft when `upload-assets` is set to `true`.

### Generic generator

#### New Features

- A new input `draft-release` was added to allow users to create releases marked as draft when `upload-assets` is set to `true`.

### Docker-based generator

#### New Features

- A new input `draft-release` was added to allow users to create releases marked as draft when `upload-assets` is set to `true`.

### Container generator

#### New Features
Expand Down
Loading

0 comments on commit 7edd74b

Please sign in to comment.