|
| 1 | +name: Build and Release |
| 2 | + |
1 | 3 | on: |
2 | 4 | push: |
3 | | - tags: |
4 | | - - "v*" |
| 5 | + branches: [main] |
| 6 | + tags: ["v*"] |
| 7 | + pull_request: |
| 8 | + branches: [main] |
| 9 | + |
| 10 | +env: |
| 11 | + CARGO_TERM_COLOR: always |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
5 | 15 |
|
6 | 16 | jobs: |
7 | | - release: |
8 | | - name: Release Zed Extension |
| 17 | + dco-check: |
| 18 | + name: DCO Check |
| 19 | + if: github.event_name == 'pull_request' |
| 20 | + runs-on: ubuntu-24.04 |
| 21 | + steps: |
| 22 | + - uses: tisonkun/actions-dco@v1.1 |
| 23 | + |
| 24 | + build: |
| 25 | + name: Build and Test |
9 | 26 | runs-on: ubuntu-24.04 |
| 27 | + outputs: |
| 28 | + hashes: ${{ steps.hash.outputs.hashes }} |
10 | 29 | steps: |
11 | | - - uses: huacnlee/zed-extension-action@v1 |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install Rust |
| 33 | + uses: dtolnay/rust-toolchain@stable |
| 34 | + with: |
| 35 | + components: clippy, rustfmt |
| 36 | + targets: wasm32-wasip1 |
| 37 | + |
| 38 | + - name: Cache dependencies |
| 39 | + uses: Swatinem/rust-cache@v2 |
| 40 | + |
| 41 | + - name: Check formatting |
| 42 | + run: cargo fmt --all -- --check |
| 43 | + |
| 44 | + - name: Run clippy |
| 45 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 46 | + |
| 47 | + - name: Build |
| 48 | + run: cargo build --verbose --target wasm32-wasip1 --release |
| 49 | + |
| 50 | + # Verify version matches extension.toml |
| 51 | + - name: Verify Version |
| 52 | + if: startsWith(github.ref, 'refs/tags/') |
| 53 | + run: | |
| 54 | + VERSION=${GITHUB_REF#refs/tags/} |
| 55 | + TOML_VERSION="v$(grep '^version = ' extension.toml | cut -d'"' -f2)" |
| 56 | + if [ "$VERSION" != "$TOML_VERSION" ]; then |
| 57 | + echo "Version mismatch: $VERSION != $TOML_VERSION" |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | +
|
| 61 | + # Generate hash for SLSA provenance |
| 62 | + - name: Generate Artifact Hash |
| 63 | + if: startsWith(github.ref, 'refs/tags/') |
| 64 | + id: hash |
| 65 | + run: | |
| 66 | + cd target/wasm32-wasip1/release/ |
| 67 | + echo "hashes=$(sha256sum *.wasm | base64 -w0)" >> "${GITHUB_OUTPUT}" |
| 68 | +
|
| 69 | + # Create GitHub release if this is a tag |
| 70 | + - name: Create GitHub Release |
| 71 | + if: startsWith(github.ref, 'refs/tags/') |
| 72 | + uses: softprops/action-gh-release@v1 |
12 | 73 | with: |
13 | | - extension-name: mcp-server-basic-memory |
14 | | - # extension-path: extensions/${{ extension-name }} |
15 | | - push-to: ossfellow/zed-mcp-server-basic-memory |
16 | | - env: |
17 | | - # the personal access token should have "repo" & "workflow" scopes |
18 | | - COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} |
| 74 | + generate_release_notes: true |
| 75 | + files: | |
| 76 | + target/wasm32-wasip1/release/*.wasm |
| 77 | +
|
| 78 | + # Generate SLSA provenance |
| 79 | + provenance: |
| 80 | + needs: [build] |
| 81 | + if: startsWith(github.ref, 'refs/tags/') |
| 82 | + permissions: |
| 83 | + actions: read # To read the workflow path |
| 84 | + id-token: write # To sign the provenance |
| 85 | + contents: write # To add assets to a release |
| 86 | + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0 |
| 87 | + with: |
| 88 | + base64-subjects: "${{ needs.build.outputs.hashes }}" |
| 89 | + upload-assets: true # Upload to the release |
| 90 | + private-repository: true # Allow provenance for private repos |
0 commit comments