diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 206d478..f3101c0 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,7 +8,7 @@ on: types: - closed branches: - - main + - master jobs: check-version: @@ -65,17 +65,3 @@ jobs: - run: npm run js:publish-nodejs && npm run js:publish-browser env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} - - publish-rust: - needs: [check-version] - if: needs.check-version.outputs.core-version-updated == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - run: npm run js:publish-nodejs && npm run js:publish-browser - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-packages.yml similarity index 61% rename from .github/workflows/publish-package.yml rename to .github/workflows/publish-packages.yml index 5c71539..66ae550 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-packages.yml @@ -83,7 +83,8 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true outputs: - rust-version-updated: ${{ steps.compare-versions.outputs.version-updated }} + core-version-updated: ${{ steps.compare-versions.outputs.core-version-updated }} + rust-version-updated: ${{ steps.compare-versions.outputs.rust-version-updated }} steps: - name: Checkout master branch at commit before merge uses: actions/checkout@v4 @@ -93,7 +94,10 @@ jobs: - name: Get package version from master branch before merge id: pre-merge-version run: | - cd packages/whisky + cd packages/sidan-csl-rs + CORE_PRE_MERGE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') + echo "core_pre_merge_version=$CORE_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" + cd ../whisky RUST_PRE_MERGE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') echo "rust_pre_merge_version=$RUST_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" @@ -105,22 +109,71 @@ jobs: - name: Get package version from master branch after merge id: post-merge-version run: | - cd packages/whisky + cd packages/sidan-csl-rs + CORE_POST_MERGE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') + echo "core_post_merge_version=$CORE_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" + cd ../whisky RUST_POST_MERGE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') echo "rust_post_merge_version=$RUST_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" - name: Compare versions id: compare-versions run: | + if [[ "${{ steps.pre-merge-version.outputs.core_pre_merge_version }}" != "${{ steps.post-merge-version.outputs.core_post_merge_version }}" ]]; then + echo "core-version-updated=true" >> "$GITHUB_OUTPUT" + else + echo "core-version-updated=false" >> "$GITHUB_OUTPUT" + fi if [[ "${{ steps.pre-merge-version.outputs.rust_pre_merge_version }}" != "${{ steps.post-merge-version.outputs.rust_post_merge_version }}" ]]; then echo "rust-version-updated=true" >> "$GITHUB_OUTPUT" else echo "rust-version-updated=false" >> "$GITHUB_OUTPUT" fi - publish-crate: - needs: build-test - name: Publish + publish-core-crate: + needs: [check-version, build-test] + if: needs.check-version.outputs.core-version-updated == 'true' + name: Publish core crate + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - run: cd packages/sidan-csl-rs && cargo publish --token ${PUBLISH_KEY} + env: + PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }} + + only-publish-whisky-crate: + needs: [check-version, build-test] + if: needs.check-version.outputs.rust-version-updated == 'true' && needs.check-version.outputs.core-version-updated == 'false' + name: Publish Whisky crate + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - run: cd packages/whisky && cargo publish --token ${PUBLISH_KEY} + env: + PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }} + + publish-whisky-crate: + needs: [check-version, build-test, publish-core-crate] + if: needs.check-version.outputs.rust-version-updated == 'true' && needs.check-version.outputs.core-version-updated == 'true' + name: Publish Whisky crate runs-on: ubuntu-latest steps: - name: Checkout sources diff --git a/packages/Cargo.lock b/packages/Cargo.lock index 362d42b..b322af2 100644 --- a/packages/Cargo.lock +++ b/packages/Cargo.lock @@ -1833,7 +1833,7 @@ dependencies = [ [[package]] name = "sidan-csl-rs" -version = "0.5.0-alpha.2" +version = "0.5.0-alpha.1" dependencies = [ "cardano-serialization-lib", "cryptoxide", @@ -2385,7 +2385,7 @@ dependencies = [ [[package]] name = "whiskey" -version = "0.5.0-alpha.2" +version = "0.5.0-alpha.1" dependencies = [ "async-trait", "cardano-serialization-lib", diff --git a/packages/sidan-csl-rs/Cargo.toml b/packages/sidan-csl-rs/Cargo.toml index 5aa5137..c8b7788 100644 --- a/packages/sidan-csl-rs/Cargo.toml +++ b/packages/sidan-csl-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sidan-csl-rs" -version = "0.5.0-alpha.2" +version = "0.5.0-alpha.1" edition = "2021" license = "Apache-2.0" description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs" diff --git a/packages/whisky/Cargo.toml b/packages/whisky/Cargo.toml index a751c97..479b1a7 100644 --- a/packages/whisky/Cargo.toml +++ b/packages/whisky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whiskey" -version = "0.5.0-alpha.2" +version = "0.5.0-alpha.1" edition = "2021" license = "Apache-2.0" description = "The Cardano Rust SDK, inspired by MeshJS" @@ -24,7 +24,7 @@ noop_proc_macro = "0.3.0" pallas-codec = "0.22.0" pallas-primitives = "0.22.0" pallas-traverse = "0.22.0" -sidan-csl-rs = { version = "=0.5.0-alpha.2", path = "../sidan-csl-rs" } +sidan-csl-rs = { version = "=0.5.0-alpha.1", path = "../sidan-csl-rs" } [profile.release] # Tell `rustc` to optimize for small code size.