ci: Set avm client version to crate version (#368)

* Set version from Cargo.toml

* Fix crate link on release
This commit is contained in:
Anatolios Laskaris 2022-10-25 10:20:42 +03:00 committed by GitHub
parent bbc521ce53
commit 22d39f5b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -69,6 +69,7 @@ jobs:
echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV
echo "JS_PKG_NAME=$JS_PKG_NAME" | tee -a $GITHUB_ENV
echo "RS_PKG_NAME=$RS_PKG_NAME" | tee -a $GITHUB_ENV
- name: Install marine
run: cargo install marine
@ -112,7 +113,7 @@ jobs:
release_name: AIR interpreter ${{ env.FINAL_VERSION }}
body: |
- [${{ env.FINAL_VERSION }} @ NPM registry](https://www.npmjs.com/package/${{ env.JS_PKG_NAME }}/v/${{ env.FINAL_VERSION }})
- [${{ env.FINAL_VERSION }} @ crates.io](https://crates.io/crates/${{ env.PKG_NAME }}/${{ env.FINAL_VERSION }})
- [${{ env.FINAL_VERSION }} @ crates.io](https://crates.io/crates/${{ env.RS_PKG_NAME }}/${{ env.FINAL_VERSION }})
draft: false
prerelease: false

View File

@ -100,10 +100,12 @@ jobs:
SHA=${{ github.event.pull_request.head.sha }}
echo "::set-output name=sha::${SHA::7}"
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}"
echo "::set-output name=avm::$(cargo read-manifest --manifest-path air-interpreter/Cargo.toml | jq -r .version)"
- name: Set package version
id: build
env:
VERSION: ${{ steps.version.outputs.avm }}
BRANCH: ${{ steps.version.outputs.branch }}
SHA: ${{ steps.version.outputs.sha }}
RUN: ${{ github.run_number }}
@ -111,9 +113,8 @@ jobs:
working-directory: avm/client
run: |
echo "::set-output name=version::$(\
npm version prerelease \
--no-git-tag-version \
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})"
npm version --no-git-tag-version \
${{ env.VERSION }}-${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})"
- name: Publish to self-hosted npm repo
working-directory: avm/client