Skip to content

Manual Packages Release #18

Manual Packages Release

Manual Packages Release #18

name: Manual Packages Release
on:
workflow_dispatch:
inputs:
version-level:
description: 'Select Version Level'
required: true
type: choice
options:
- alpha # Increase the alpha pre-version (x.y.z-alpha.M)
- beta # Increase the beta pre-version (x.y.z-beta.M)
- patch # Increase the patch version (x.y.z)
- minor # Increase the minor version (x.y.0)
- major # Increase the major version (x.0.0)
- release # Remove the pre-version, ie remove alpha/beta/rc (x.y.z)
- rc # Increase the rc pre-version (x.y.z-rc.M)
jobs:
release:
runs-on: ubuntu-latest
env:
DEPLOYMENT_KEY: ${{ github.ref == 'refs/heads/main' && secrets.PRIVATE_KEY || secrets.PRIVATE_KEY_DEV }}
DEPLOY_METABOARD_ADDRESS: ${{ vars.CI_DEPLOY_SEPOLIA_METABOARD_ADDRESS }}
CI_FORK_SEPOLIA_BLOCK_NUMBER: ${{ vars.CI_FORK_SEPOLIA_BLOCK_NUMBER }}
CI_FORK_SEPOLIA_DEPLOYER_ADDRESS: ${{ vars.CI_FORK_SEPOLIA_DEPLOYER_ADDRESS }}
CI_DEPLOY_SEPOLIA_RPC_URL: ${{ secrets.CI_DEPLOY_SEPOLIA_RPC_URL || vars.CI_DEPLOY_SEPOLIA_RPC_URL }}
CI_SEPOLIA_METABOARD_URL: ${{ vars.CI_SEPOLIA_METABOARD_URL }}
CI_DEPLOY_POLYGON_RPC_URL: ${{ secrets.CI_DEPLOY_POLYGON_RPC_URL }}
RPC_URL_ETHEREUM_FORK: ${{ secrets.RPC_URL_ETHEREUM_FORK }}
CI_DEPLOY_FLARE_RPC_URL: ${{ secrets.CI_DEPLOY_FLARE_RPC_URL }}
COMMIT_SHA: ${{ github.sha }}
outputs:
version: ${{ env.NEW_VERSION }}
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.PUBLISH_PRIVATE_KEY }}
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Install NodeJS v22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: nix develop -c rainix-sol-prelude
working-directory: lib/rain.interpreter
- run: nix develop -c rainix-rs-prelude
working-directory: lib/rain.interpreter
- run: nix develop -c rainix-sol-prelude
working-directory: lib/rain.interpreter/lib/rain.metadata
- run: nix develop -c rainix-rs-prelude
working-directory: lib/rain.interpreter/lib/rain.metadata
- run: nix develop -c rainix-sol-prelude
- run: nix develop -c rainix-rs-prelude
- run: nix develop -c raindex-prelude
- name: Test JS/TS Binding 1/2
run: nix develop -c rainix-wasm-test
- name: Test JS/TS Binding 2/2
run: nix develop -c test-js-bindings
- name: Git Config
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"
# - name: Publish to crates.io
# run: nix develop -c cargo release --no-confirm --execute --no-tag -p rain_orderbook_common ${{ inputs.version-level }}
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# set npm version to rust crate version
- name: Set Version
run: echo "NEW_VERSION=$(node ./scripts/version.js ${{ inputs.version-level }})" >> $GITHUB_ENV
# Commit changes and tag
- name: Commit And Tag
run: |
git add "package.json"
git add "package-lock.json"
git commit -m "Release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
# Push the commit to remote
- name: Push Changes To Remote
run: |
git push origin
git push -u origin ${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create npm package tarball to put in release files
- name: Create NPM Package Tarball
run: echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV
- name: Rename NPM Package Tarball
run: mv ${{ env.NPM_PACKAGE }} orderbook_npm_package_${{ env.NEW_VERSION }}.tgz
# publish to npm
- name: Publish To NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
# Create gitHub release with npm tarball
- name: Create GitHub Release
id: gh_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.NEW_VERSION }}
name: Package Release ${{ env.NEW_VERSION }}
files: orderbook_npm_package_${{ env.NEW_VERSION }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}