|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | release-package: |
10 | | - environment: publish |
11 | | - runs-on: windows-latest |
| 10 | + runs-on: ubuntu-latest |
12 | 11 | permissions: |
13 | 12 | contents: write # for googleapis/release-please-action to create release commit |
14 | 13 | pull-requests: write # for googleapis/release-please-action to create release PR |
15 | | - packages: read # for internal nuget reading |
| 14 | + issues: write # for googleapis/release-please-action to create labels |
16 | 15 |
|
17 | 16 | steps: |
18 | | - - uses: google-github-actions/release-please-action@db8f2c60ee802b3748b512940dde88eabd7b7e01 # v3 |
| 17 | + - uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 #v4 |
19 | 18 | id: release |
20 | 19 | with: |
21 | | - command: manifest |
22 | | - token: ${{secrets.GITHUB_TOKEN}} |
23 | | - default-branch: main |
| 20 | + token: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}} |
24 | 21 | release-type: simple |
| 22 | + outputs: |
| 23 | + release_created: ${{ steps.release.outputs.releases_created }} |
| 24 | + release_tag_name: ${{ steps.release.outputs.release_tag_name }} |
| 25 | + paths_released: ${{ fromJSON(steps.release.outputs.paths_released)[0] != null }} # if we have a single release path, do the release |
| 26 | + |
| 27 | + release: |
| 28 | + needs: release-package |
| 29 | + environment: publish |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + id-token: write |
| 33 | + contents: write # upload sbom to a release |
| 34 | + attestations: write |
| 35 | + packages: read # for internal nuget reading |
| 36 | + if: ${{ needs.release-package.outputs.release_created }} |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + release: ${{ fromJSON(needs.release-package.outputs.paths_released) }} |
25 | 40 |
|
| 41 | + steps: |
26 | 42 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
27 | | - if: ${{ steps.release.outputs.releases_created }} |
28 | 43 | with: |
29 | 44 | fetch-depth: 0 |
30 | 45 | submodules: recursive |
31 | 46 |
|
32 | 47 | - name: Setup .NET SDK |
33 | 48 | uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 |
34 | | - if: ${{ steps.release.outputs.releases_created }} |
35 | 49 | env: |
36 | 50 | NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
37 | 51 | with: |
38 | 52 | global-json-file: global.json |
39 | 53 | source-url: https://nuget.pkg.github.com/open-feature/index.json |
40 | 54 |
|
41 | 55 | - name: Install dependencies |
42 | | - if: ${{ steps.release.outputs.releases_created }} |
43 | 56 | run: dotnet restore |
44 | 57 |
|
45 | 58 | - name: Build |
46 | | - if: ${{ steps.release.outputs.releases_created }} |
47 | 59 | run: | |
48 | 60 | dotnet build --configuration Release --no-restore -p:Deterministic=true |
49 | 61 |
|
50 | 62 | - name: Pack |
51 | | - if: ${{ steps.release.outputs.releases_created }} |
52 | 63 | run: | |
53 | 64 | dotnet pack --configuration Release --no-build |
54 | 65 |
|
55 | 66 | - name: Publish to Nuget |
56 | | - if: ${{ steps.release.outputs.releases_created }} |
57 | 67 | run: | |
58 | | - dotnet nuget push --skip-duplicate "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} |
| 68 | + dotnet nuget push "${{ matrix.release }}/**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} |
| 69 | +
|
| 70 | + - name: Generate artifact attestation |
| 71 | + uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3 |
| 72 | + with: |
| 73 | + subject-path: "${{ matrix.release }}/**/*.nupkg" |
| 74 | + |
| 75 | + - name: Generate JSON SBOM |
| 76 | + uses: CycloneDX/gh-dotnet-generate-sbom@c183e4ac30e5b99354cb9a98c38548e07c538346 # v1.0.1 |
| 77 | + with: |
| 78 | + path: "${{ matrix.release }}/**/*.csproj" |
| 79 | + out: ./artifacts/sboms |
| 80 | + json: true |
| 81 | + github-bearer-token: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + |
| 83 | + - name: Attest package |
| 84 | + uses: actions/attest-sbom@115c3be05ff3974bcbd596578934b3f9ce39bf68 # v2.2.0 |
| 85 | + with: |
| 86 | + subject-path: "${{ matrix.release }}/**/*.nupkg" |
| 87 | + sbom-path: artifacts/sboms/bom.json |
| 88 | + |
| 89 | + - name: Attach SBOM to artifact |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 92 | + run: gh release upload ${{ needs.release-package.outputs.release_tag_name }} artifacts/sboms/bom.json |
0 commit comments