55 inputs :
66 bump :
77 description : ' Bump version by semver keyword.'
8+ type : string
9+ required : true
10+ bump-rust :
11+ description : ' Bump Rust version.'
12+ type : boolean
13+ required : true
14+ bump-typescript :
15+ description : ' Bump TypeScript version.'
16+ type : boolean
817 required : true
18+ bump-typescript-tool :
19+ description : ' TypeScript tool to use for bumping (`lerna` or `npm`).'
20+ type : string
21+ required : false
22+ default : ' lerna'
23+ extract-version :
24+ description : ' Version to extract (`rust` or `typescript`).'
925 type : string
26+ required : true
1027
1128 # Inputs for `actions-rust-lang/setup-rust-toolchain`.
1229 # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/action.yml
1835 description : ' Target triple to install for this toolchain'
1936 type : string
2037 required : false
38+ secrets :
39+ app-client-id :
40+ description : ' GitHub App Client ID.'
41+ required : true
42+ app-private-key :
43+ description : ' GitHub App private key.'
44+ required : true
2145
2246permissions :
2347 contents : write
@@ -32,39 +56,83 @@ jobs:
3256 id : app-token
3357 uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
3458 with :
35- client-id : ${{ secrets.APP_ID }}
36- private-key : ${{ secrets.APP_PRIVATE_KEY }}
59+ client-id : ${{ secrets.app-client-id }}
60+ private-key : ${{ secrets.app-private-key }}
3761
3862 - name : Checkout
3963 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4064
4165 - name : Set up Rust toolchain
66+ if : ${{ inputs.bump-rust }}
4267 uses : actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
4368 with :
4469 toolchain : ${{ inputs.toolchain }}
4570 target : ${{ inputs.target }}
4671
4772 - name : Install Cargo Binary Install
73+ if : ${{ inputs.bump-rust }}
4874 uses : cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1
4975
5076 - name : Install crates
77+ if : ${{ inputs.bump-rust }}
5178 run : cargo binstall --force -y cargo-workspaces toml-cli
5279
53- - name : Bump version
80+ - name : Bump Rust version
81+ if : ${{ inputs.bump-rust }}
5482 run : cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }}
5583
56- - name : Extract version
57- id : extract-version
84+ - name : Extract Rust version
85+ if : ${{ inputs.extract-version == 'rust' }}
86+ id : extract-rust-version
5887 run : echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT"
5988
89+ - name : Set up Node.js
90+ if : ${{ inputs.bump-typescript }}
91+ uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
92+ with :
93+ node-version : ' lts/*'
94+ cache : ' npm'
95+
96+ - name : Install dependencies
97+ if : ${{ inputs.bump-typescript }}
98+ run : npm ci
99+
100+ - name : Bump TypeScript version
101+ if : ${{ inputs.bump-typescript }}
102+ env :
103+ TOOL : ${{ case(inputs.bump-typescript-tool == 'lerna', 'npx lerna', 'npm') }}
104+ run : $TOOL version --no-git-tag-version --yes ${{ inputs.bump }}
105+
106+ - name : Extract TypeScript version
107+ if : ${{ inputs.extract-version == 'typescript' }}
108+ id : extract-typescript-version
109+ env :
110+ FILE : ${{ case(inputs.bump-typescript-tool == 'lerna', 'lerna', 'package') }}
111+ run : echo "VERSION=v$(jq -r .version ./$FILE.json)" >> "$GITHUB_OUTPUT"
112+
113+ - name : Format with Prettier
114+ if : ${{ inputs.extract-version == 'typescript' }}
115+ run : npx prettier --write .
116+
117+ - name : Version
118+ id : version
119+ env :
120+ VERSION : |-
121+ ${{ case(
122+ inputs.extract-version == 'rust', steps.extract-rust-version.outputs.VERSION,
123+ inputs.extract-version == 'typescript', steps.extract-typescript-version.outputs.VERSION,
124+ ''
125+ ) }}
126+ run : test -n "$VERSION" && echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
127+
60128 - name : Add changes
61129 run : git add .
62130
63131 - name : Commit
64132 id : commit
65133 uses : dsanders11/github-app-commit-action@2bbcd331016d8c950b05a24b56e7eb9cb50d545e # v2.1.0
66134 with :
67- message : ${{ steps.extract- version.outputs.VERSION }}
135+ message : ${{ steps.version.outputs.VERSION }}
68136 token : ${{ steps.app-token.outputs.token }}
69137
70138 - name : Reset and pull
73141 - name : Tag
74142 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
75143 env :
76- GIT_TAG : ${{ steps.extract- version.outputs.VERSION }}
144+ GIT_TAG : ${{ steps.version.outputs.VERSION }}
77145 GIT_SHA : ${{ steps.commit.outputs.sha }}
78146 with :
79147 script : |
89157 with :
90158 generate_release_notes : true
91159 make_latest : true
92- tag_name : ${{ steps.extract- version.outputs.VERSION }}
160+ tag_name : ${{ steps.version.outputs.VERSION }}
93161 token : ${{ steps.app-token.outputs.token }}
0 commit comments