Skip to content

Commit adcc786

Browse files
authored
Properly set version numbers in publish script (#411)
* Properly set version numbers in publish script * Publish more npm packages * Rust sdk publish
1 parent e16cf30 commit adcc786

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/actions/version/action.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@ runs:
4242
- name: Update npm Packages
4343
if: ${{ steps.env.outputs.ENV == 'npm' }}
4444
run: |
45-
sed -i 's/"version": ".*"/"version": "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
46-
# TODO: Following should only happen in dependencies and not devDependencies
47-
# sed -i 's/"\*"/"${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
45+
jq --arg version "${{ steps.version.outputs.VERSION }}" '
46+
.version = $version
47+
' ${{ inputs.manifest-file }} > tmp.json && mv tmp.json ${{ inputs.manifest-file }}
48+
jq --arg version "${{ steps.version.outputs.VERSION }}" '
49+
.dependencies |= with_entries(if .value == "*" then .value = $version else . end)
50+
' ${{ inputs.manifest-file }} > tmp.json && mv tmp.json ${{ inputs.manifest-file }}
4851
shell: bash
4952
- name: Update Cargo Packages
5053
if: ${{ steps.env.outputs.ENV == 'cargo' }}
5154
run: |
52-
sed -i 's/^version = ".*"$/version = "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
53-
# TODO: Following should only happen in dependencies and not dev-dependencies
54-
# sed -i 's/path = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
55+
awk -v version="${{ steps.version.outputs.VERSION }}" '
56+
/^version = / { sub(/".*"/, "\"" version "\"") } { print }
57+
' ${{ inputs.manifest-file }} > tmp.toml && mv tmp.toml ${{ inputs.manifest-file }}
58+
awk -v version="${{ steps.version.outputs.VERSION }}" '
59+
/^\[dependencies\]/ { in_dependencies=1 }
60+
/^\[/ && !/^\[dependencies\]/ { in_dependencies=0 }
61+
in_dependencies && /path = ".*"/ { sub(/path = ".*"/, "version = \"" version "\"") } { print }
62+
' ${{ inputs.manifest-file }} > tmp.toml && mv tmp.toml ${{ inputs.manifest-file }}
5563
shell: bash

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
npm:
1111
strategy:
1212
matrix:
13-
package: [client]
13+
package: [client, core, whirlpool]
1414
max-parallel: 1
1515
fail-fast: true
1616
runs-on: ubuntu-latest
@@ -39,7 +39,7 @@ jobs:
3939
cargo:
4040
strategy:
4141
matrix:
42-
package: [client]
42+
package: [client, core]
4343
max-parallel: 1
4444
fail-fast: true
4545
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)