Skip to content

Commit f2a38fa

Browse files
committed
Don't rely on tomlq
Github has `yq`, but not the ubuntu `yq` package, which includes `tomlq`. Therefore, we need to do some workarounds to get version postpends to work
1 parent a4965d1 commit f2a38fa

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Generate VRChat API SDK
2222
env:
23+
ARTIFACT_NAME: "openapi.json"
2324
INPUT: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json }}
24-
SPEC_URL: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['artifacts']['openapi.json'] }}
25+
SPEC_URL: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['artifacts'][env.ARTIFACT_NAME] }}
2526
PASSED_VERSION: ${{ fromJSON(github.event_name == 'repository_dispatch' && github.event.client_payload || inputs.json)['version'] }}
2627
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}
2728
steps:
@@ -47,20 +48,28 @@ jobs:
4748
distribution: 'adopt'
4849
- name: Install Rustup toolchain
4950
uses: moonrepo/setup-rust@v1
50-
- name: Generate SDK Client
51-
run: bash ./generate.sh ${SPEC_URL}
51+
- name: Download Specification
52+
run: wget "${SPEC_URL}"
5253
- name: Check version number
5354
run: |
5455
set -euo pipefail
55-
VERSION=
56-
if [ "$(tomlq .package.version Cargo.toml -r)" != ${PASSED_VERSION}]
56+
if [ "$(yq '.info.version' "${ARTIFACT_NAME}")" != ${PASSED_VERSION} ]
5757
then
5858
echo "Mismatch between actual and expected version!\nAborting Release." >&2
5959
exit 1
6060
fi
61-
if [ "${VERSION_POSTPEND}" != "" ]
61+
- name: Apply Version Postpend
62+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix != '' }}
63+
run: yq '--inplace' ".info.version |= \"${PASSED_VERSION}${VERSION_POSTPEND}\"" "${ARTIFACT_NAME}"
64+
- name: Generate SDK Client
65+
run: bash ./generate.sh "${ARTIFACT_NAME}"
66+
- name: Check version number
67+
run: |
68+
set -euo pipefail
69+
if [ "$(yq '--input-format=toml' '--output-format=toml' '.package.version' 'Cargo.toml')" != "${PASSED_VERSION}${VERSION_POSTPEND}" ]
6270
then
63-
tomlq '.package.version |= "${PASSED_VERSION}${VERSION_POSTPEND}"' Cargo.toml --toml-output --in-place
71+
echo "Mismatch between actual and expected version!\nAborting Release." >&2
72+
exit 1
6473
fi
6574
- name: Deploy SDK back into main branch
6675
uses: JamesIves/github-pages-deploy-action@v4

0 commit comments

Comments
 (0)