-
Notifications
You must be signed in to change notification settings - Fork 78
105 lines (90 loc) · 2.72 KB
/
deploy-rust-client.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Deploy Rust Client
on:
workflow_dispatch:
inputs:
level:
description: Level
required: true
default: patch
type: choice
options:
- patch
- minor
- major
- rc
- beta
- alpha
- release
- version
version:
description: Version
required: false
type: string
dry_run:
description: Dry run
required: true
default: true
type: boolean
env:
CACHE: true
jobs:
build_programs:
name: Programs
uses: ./.github/workflows/build-programs.yml
secrets: inherit
build_rust_client:
name: Rust Client
uses: ./.github/workflows/build-rust-client.yml
secrets: inherit
test_rust_client:
name: Rust Client
needs: [build_programs, build_rust_client]
uses: ./.github/workflows/test-rust-client.yml
secrets: inherit
publish_crate:
name: Rust Client / Publish Crate
runs-on: ubuntu-latest
needs: test_rust_client
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.SVC_TOKEN }}
- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV
- name: Install Rust
uses: metaplex-foundation/actions/install-rust@v1
with:
toolchain: "1.72.0"
- name: Install cargo-release
uses: metaplex-foundation/actions/install-cargo-release@v1
with:
cache: ${{ env.CACHE }}
- name: Publish crate
working-directory: ./clients/rust
run: |
if [ "${{ inputs.level }}" == "version" ]; then
BUMP=${{ inputs.version }}
else
BUMP=${{ inputs.level }}
fi
if [ "${{ inputs.dry_run }}" == "false" ]; then
OPTIONS="--no-push --no-tag --no-confirm --execute"
git config user.name ${{ env.COMMIT_USER_NAME }}
git config user.email ${{ env.COMMIT_USER_EMAIL }}
fi
cargo login ${{ secrets.CRATES_TOKEN }}
cargo release $BUMP $OPTIONS
if [ "${{ inputs.dry_run }}" == "false" ]; then
git reset --soft HEAD~1
fi
PROGRAM_VERSION=`grep -E '^version\s*=' Cargo.toml | awk -F '"' '{print $2}'`
echo PROGRAM_VERSION="${PROGRAM_VERSION}" >> $GITHUB_ENV
- name: Commit and tag new version
uses: stefanzweifel/git-auto-commit-action@v4
if: github.event.inputs.dry_run == 'false'
with:
commit_message: "chore: Release mpl-token-metadata version ${{ env.PROGRAM_VERSION }}"
tagging_message: mpl-token-metadata@v${{ env.PROGRAM_VERSION }}