Publish tagged crates and NPMs #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# Publishes tagged version to crates.io and to GitHub Packages NPM | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
name: Publish tagged crates and NPMs | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]' | |
env: | |
REGISTRY: "https://npm.pkg.github.com" | |
SDK_JS_PACKAGE_NAME: "@kindredgroup/cohort_sdk_js" | |
DIR_SDK_JS: packages/cohort_sdk_js | |
DIR_SDK_JS_CLIENT: cohort_sdk_client | |
jobs: | |
publish: | |
name: Publish crates | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- run: scripts/ubuntu-setup.sh | |
- run: rustup component add rustfmt clippy | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
check-latest: true | |
registry-url: "https://npm.pkg.github.com" | |
- name: "Extract tag name" | |
shell: bash | |
run: |- | |
echo "VERSION_NAME=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: "Publish ${{ env.DIR_SDK_JS }} NPM" | |
shell: bash | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: |- | |
currentDir=$(pwd) | |
cd $DIR_SDK_JS | |
pwd | |
ls -l | |
echo "Current version is" | |
npm version | |
npm publish --foreground-scripts | |
echo "" | |
- name: "Publish ${{ env.DIR_SDK_JS_CLIENT }} NPM" | |
shell: bash | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: |- | |
currentDir=$(pwd) | |
cd $DIR_SDK_JS_CLIENT | |
pwd | |
ls -l | |
echo "Current version is" | |
echo "Updating $SDK_JS_PACKAGE_NAME to $VERSION_NAME" | |
rm package-lock.json || true | |
echo "D: npm install $SDK_JS_PACKAGE_NAME@$VERSION_NAME --foreground-scripts" | |
npm install $SDK_JS_PACKAGE_NAME@$VERSION_NAME --foreground-scripts | |
npm version | |
npm publish --foreground-scripts | |
echo "" | |
cd $currentDir | |
- name: Publish talos_metrics@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_metrics | |
- name: Publish talos_suffix@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_suffix | |
- name: Publish talos_certifier@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_certifier | |
- name: Publish talos_common_utils@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_common_utils | |
- name: Publish talos_rdkafka_utils@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_rdkafka_utils | |
- name: Publish talos_certifier_adapters@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_certifier_adapters | |
# Talos messenger core | |
- name: Publish talos_messenger_core@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_messenger_core | |
# Talos messenger actions | |
- name: Publish talos_messenger_actions@ ${{ env.VERSION_NAME }} crate | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN_TALOS }} | |
run: |- | |
cargo publish -v -p talos_messenger_actions |