-
Notifications
You must be signed in to change notification settings - Fork 56
80 lines (73 loc) · 2.63 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build-Release
on:
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
env:
GIT_TAG: ${{ github.event.inputs.tag }}
jobs:
build-and-push-rust:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
CARGO_REGISTRY_TOKEN: "op://GitHubActionsPublic/CARGO_REGISTRY_TOKEN/credential"
- uses: actions/checkout@v4
- run: cargo build --verbose
- run: cargo test update_package_version -- ${{ inputs.tag }} --nocapture
- run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update cargo.toml version to ${{ env.GIT_TAG }}" -a
- run: cargo publish --manifest-path csbindgen/Cargo.toml
env:
CARGO_REGISTRY_TOKEN: ${{ steps.op-load-secret.outputs.CARGO_REGISTRY_TOKEN }}
- run: git tag ${{ env.GIT_TAG }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
build-dotnet:
needs: [build-and-push-rust]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
NUGET_KEY: "op://GitHubActionsPublic/NUGET_KEY/credential"
- uses: actions/checkout@v4
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
# pack nuget
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
- run: dotnet nuget push "./publish/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ steps.op-load-secret.outputs.NUGET_KEY }}
create-release:
needs: [build-dotnet, build-and-push-rust]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Create Releases
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_TAG }}
release_name: Ver.${{ env.GIT_TAG }}
draft: true
prerelease: false