Skip to content

Commit cd9346d

Browse files
authored
Merge pull request #78 from Cysharp/feature/secret
feat: change load secret from op
2 parents e53634e + a3235a3 commit cd9346d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/build-release.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ jobs:
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717
steps:
18+
- name: Load secrets
19+
id: op-load-secret
20+
uses: 1password/load-secrets-action@v2
21+
with:
22+
export-env: false
23+
env:
24+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
25+
CARGO_REGISTRY_TOKEN: "op://GitHubActionsPublic/CARGO_REGISTRY_TOKEN/credential"
26+
1827
- uses: actions/checkout@v3
1928
- run: cargo build --verbose
2029
- run: cargo test update_package_version -- ${{ inputs.tag }} --nocapture
@@ -24,7 +33,7 @@ jobs:
2433
git commit -m "Update cargo.toml version to ${{ env.GIT_TAG }}" -a
2534
- run: cargo publish --manifest-path csbindgen/Cargo.toml
2635
env:
27-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
36+
CARGO_REGISTRY_TOKEN: ${{ steps.op-load-secret.outputs.CARGO_REGISTRY_TOKEN }}
2837
- run: git tag ${{ env.GIT_TAG }}
2938
- name: Push changes
3039
uses: ad-m/github-push-action@master
@@ -38,12 +47,21 @@ jobs:
3847
runs-on: ubuntu-latest
3948
timeout-minutes: 10
4049
steps:
50+
- name: Load secrets
51+
id: op-load-secret
52+
uses: 1password/load-secrets-action@v2
53+
with:
54+
export-env: false
55+
env:
56+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
57+
NUGET_KEY: "op://GitHubActionsPublic/NUGET_KEY/credential"
58+
4159
- uses: actions/checkout@v3
4260
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
4361
# pack nuget
4462
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
4563
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
46-
- run: dotnet nuget push "./publish/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
64+
- run: dotnet nuget push "./publish/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ steps.op-load-secret.outputs.NUGET_KEY }}
4765

4866
create-release:
4967
needs: [build-dotnet, build-and-push-rust]

0 commit comments

Comments
 (0)