Skip to content

Commit 45215f3

Browse files
authored
feat: create attestations on upload with cosign (#1679)
1 parent 2b9fccc commit 45215f3

File tree

7 files changed

+510
-18
lines changed

7 files changed

+510
-18
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
package_url:
5+
description: "Full URL to download the package from"
6+
required: true
7+
default: "https://repo.prefix.dev/conda-forge/noarch/rich-13.7.0-pyhd8ed1ab_0.conda"
8+
channel:
9+
description: "Channel to upload to"
10+
required: true
11+
default: "wolf-private-test"
12+
13+
name: Test Cosign Attestation
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
RUST_LOG: info
21+
RUST_BACKTRACE: 1
22+
CARGO_TERM_COLOR: always
23+
24+
jobs:
25+
test-attestation:
26+
name: Test Cosign Attestation Upload
27+
runs-on: ubuntu-22.04
28+
29+
# These permissions are needed to create a sigstore certificate.
30+
permissions:
31+
id-token: write
32+
contents: read
33+
attestations: write
34+
35+
steps:
36+
- name: Checkout source code
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
with:
39+
submodules: recursive
40+
41+
- name: Install Rust toolchain
42+
run: |
43+
rustup component add rustfmt
44+
rustup target add x86_64-unknown-linux-musl
45+
46+
- name: Install musl tools
47+
run: |
48+
sudo apt install musl-tools gcc g++
49+
sudo ln -s /usr/bin/musl-gcc /usr/bin/musl-g++
50+
51+
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
52+
53+
- name: Show version information (Rust, cargo, GCC)
54+
shell: bash
55+
run: |
56+
gcc --version || true
57+
rustup -V
58+
rustup toolchain list
59+
cargo -V
60+
rustc -V
61+
62+
- name: Install Cosign
63+
uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0
64+
65+
- name: Download package
66+
run: |
67+
PACKAGE_NAME=$(basename ${{ inputs.package_url }})
68+
curl -L -o $PACKAGE_NAME ${{ inputs.package_url }}
69+
ls -lh $PACKAGE_NAME
70+
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
71+
72+
- name: Run rattler upload with attestation generation
73+
run: |
74+
cargo run --bin rattler -- upload prefix --generate-attestation -c ${{ inputs.channel }} $PACKAGE_NAME

0 commit comments

Comments
 (0)