Skip to content

Commit 54984ab

Browse files
committed
ci: Add integrate workflow
This ensures that conftest builds successfull on all of the supported OSes, and that the provenance generation workflow is working. It also provides a mechanism for users to obtain pre-release versions of fixes and features they care about without having to build from source. Signed-off-by: James Alseth <james@jalseth.me>
1 parent 7de1f99 commit 54984ab

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/integrate.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 'integrate'
2+
on:
3+
# TODO: Remove pull_request below after testing is done.
4+
pull_request:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
jobs:
11+
goreleaser:
12+
runs-on: 'ubuntu-latest'
13+
permissions:
14+
contents: 'write' # Needs write access for upload-artifact.
15+
outputs:
16+
hashes: '${{ steps.outputs.outputs.hashes }}'
17+
steps:
18+
- name: 'checkout'
19+
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5
20+
with:
21+
fetch-depth: 0 # So that goreleaser can determine the base version.
22+
- name: 'build'
23+
id: 'goreleaser'
24+
uses: 'goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a' # ratchet:goreleaser/goreleaser-action@v6
25+
with:
26+
args: 'release --snapshot --clean --skip docker --skip publish'
27+
version: '~> v1'
28+
- name: 'get filename friendly git ref'
29+
id: 'git-ref'
30+
shell: 'bash'
31+
env:
32+
GIT_REF: '${{ github.ref }}'
33+
run: |
34+
echo "ref=$(echo "${GIT_REF}" | sed 's/\//-/g' )" >> "$GITHUB_OUTPUT"
35+
- name: 'upload'
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
37+
with:
38+
name: 'conftest_${{ steps.git-ref.outputs.ref }}_${{ github.sha }}'
39+
path: 'dist/*.*'
40+
retention-days: 30
41+
- name: 'generate outputs'
42+
id: 'outputs'
43+
env:
44+
GORELEASER_ARTIFACTS: '${{ steps.goreleaser.outputs.artifacts }}'
45+
shell: 'bash'
46+
run: |
47+
set -euo pipefail
48+
49+
checksum_file=$(echo "${GORELEASER_ARTIFACTS}" | jq -r '.[] | select (.type == "Checksum") | .path' | tr -d '\n')
50+
echo "hashes=$(cat ${checksum_file} | base64 -w0)" >> "$GITHUB_OUTPUT"
51+
52+
provenance:
53+
needs: ['goreleaser']
54+
permissions:
55+
contents: 'write' # Needs write access for upload-artifact even when upload-assets is false.
56+
actions: 'read' # To read the workflow path.
57+
id-token: 'write' # To sign the provenance.
58+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0 # ratchet:exclude
59+
with:
60+
base64-subjects: '${{ needs.goreleaser.outputs.hashes }}'
61+
upload-assets: false

0 commit comments

Comments
 (0)