-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add draft-release support #167
Merged
ianlewis
merged 1 commit into
slsa-framework:main
from
developer-guy:feature/e2e-draft-release
May 2, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
.github/workflows/e2e.go.tag.main.config-ldflags-assets-draft-tag.slsa3.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
on: | ||
schedule: | ||
- cron: "0 2 * * *" | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" # # triggers only if push new tag version, like `v0.8.4` or else | ||
|
||
permissions: read-all | ||
|
||
env: | ||
GH_TOKEN: ${{ secrets.E2E_GO_TOKEN }} | ||
ISSUE_REPOSITORY: slsa-framework/slsa-github-generator | ||
# WARNING: update build job if CONFIG_FILE changes. | ||
CONFIG_FILE: .github/configs-go/config-ldflags-tag.yml | ||
DEFAULT_VERSION: v36.0.0 | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
- id: create | ||
run: | | ||
set -euo pipefail | ||
|
||
./.github/workflows/scripts/e2e-create-release.sh | ||
|
||
shim: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref_type == 'tag' | ||
outputs: | ||
continue: ${{ steps.verify.outputs.continue }} | ||
steps: | ||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
- id: verify | ||
run: | | ||
set -euo pipefail | ||
|
||
./.github/workflows/scripts/e2e-verify-release.sh | ||
|
||
args: | ||
needs: [shim] | ||
if: needs.shim.outputs.continue == 'yes' && github.event_name == 'push' && github.ref_type == 'tag' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.ldflags.outputs.version }} | ||
commit: ${{ steps.ldflags.outputs.commit }} | ||
branch: ${{ steps.ldflags.outputs.branch }} | ||
steps: | ||
- id: checkout | ||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
with: | ||
fetch-depth: 0 | ||
- id: ldflags | ||
run: | | ||
set -euo pipefail | ||
|
||
THIS_FILE=$(gh api -H "Accept: application/vnd.github.v3+json" "/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | jq -r '.path' | cut -d '/' -f3) | ||
BRANCH=$(echo "$THIS_FILE" | cut -d '.' -f4) | ||
echo "::set-output name=version::-X main.gitVersion=v1.2.3" | ||
echo "::set-output name=commit::-X main.gitCommit=abcdef" | ||
echo "::set-output name=branch::-X main.gitBranch=$BRANCH" | ||
|
||
build: | ||
needs: [shim, args] | ||
if: needs.shim.outputs.continue == 'yes' && github.event_name == 'push' && github.ref_type == 'tag' | ||
permissions: | ||
id-token: write # For signing. | ||
contents: write # For asset uploads. | ||
actions: read # For the entrypoint. | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@main | ||
with: | ||
go-version: 1.18 | ||
# We cannot use ${{ env.CONFIG_FILE }} because env variables are not available. | ||
config-file: .github/configs-go/config-ldflags-tag.yml | ||
evaluated-envs: "VERSION:${{needs.args.outputs.version}},COMMIT:${{needs.args.outputs.commit}},BRANCH:${{needs.args.outputs.branch}}" | ||
compile-builder: true | ||
draft-release: true | ||
|
||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - run: | | ||
# echo hello | ||
# #exit 1 | ||
|
||
verify: | ||
runs-on: ubuntu-latest | ||
needs: [shim, build] | ||
if: needs.shim.outputs.continue == 'yes' && github.event_name == 'push' && github.ref_type == 'tag' | ||
steps: | ||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
- uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b | ||
with: | ||
name: ${{ needs.build.outputs.go-binary-name }} | ||
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: ${{ needs.build.outputs.go-binary-name }}.intoto.jsonl | ||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | ||
with: | ||
go-version: "1.18" | ||
- env: | ||
BINARY: ${{ needs.build.outputs.go-binary-name }} | ||
# NOTE: we download the artifact as `${{ needs.build.outputs.go-binary-name }}.intoto.jsonl`, | ||
# so we implictely verify that `${{ needs.build.outputs.go-binary-name }}.intoto.jsonl = ${{ needs.build.outputs.go-provenance-name }}`. | ||
PROVENANCE: ${{ needs.build.outputs.go-provenance-name }} | ||
run: ./.github/workflows/scripts/e2e.go.default.verify.sh | ||
|
||
if-succeeded: | ||
runs-on: ubuntu-latest | ||
needs: [shim, build, verify] | ||
if: needs.shim.outputs.continue == 'yes' && github.event_name == 'push' && github.ref_type == 'tag' && needs.build.result == 'success' && needs.verify.result == 'success' | ||
steps: | ||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
- run: ./.github/workflows/scripts/e2e-report-success.sh | ||
|
||
if-failed: | ||
runs-on: ubuntu-latest | ||
needs: [shim, build, verify] | ||
if: always() && needs.shim.outputs.continue == 'yes' && github.event_name == 'push' && github.ref_type == 'tag' && (needs.build.result == 'failure' || needs.verify.result == 'failure') | ||
steps: | ||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | ||
- run: ./.github/workflows/scripts/e2e-report-failure.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to update this file to mark the release as a draft in the API call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I added draft release support into the script, thanks.