Skip to content

update README.md

update README.md #92

Workflow file for this run

name: Continuous Deployment
on:
push:
env:
ROTEL_VERSION: "tags/v0.0.1-alpha22"
jobs:
publish-npm-binaries:
name: Publish NPM packages
runs-on: ${{ matrix.build.os }}
strategy:
fail-fast: false
matrix:
build:
- {
NAME: linux-x64-glibc,
OS: ubuntu-22.04,
runner: ubuntu-latest,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-gnu,
ARTIFACT: rotel_v0.0.1-alpha22_x86_64-unknown-linux-gnu.tar.gz,
}
- {
NAME: linux-arm64-glibc,
OS: ubuntu-22.04,
runner: ubuntu-latest,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-gnu,
ARTIFACT: rotel_v0.0.1-alpha22_aarch64-unknown-linux-gnu.tar.gz,
}
- {
NAME: darwin-arm64,
OS: macos-14,
runner: macos-latest,
TOOLCHAIN: stable,
TARGET: aarch64-apple-darwin,
ARTIFACT: rotel_v0.0.1-alpha22_aarch64-apple-darwin.tar.gz,
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: update apt cache on linux
if: matrix.build.os == 'ubuntu-20.04'
run: |
sudo apt-get update
- name: Set build env
run: echo "BUILD_SHORT_SHA=$(echo -n $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18.19.0"
registry-url: "https://registry.npmjs.org"
- name: Download Rotel
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: 'streamfold/rotel'
version: ${{ env.ROTEL_VERSION }}
file: ${{ matrix.build.ARTIFACT }}
token: ${{ secrets.AGENT_DOWNLOAD_TOKEN }}
- name: Publish to NPM
shell: bash
run: |
tar -O -zxf ${{matrix.build.ARTIFACT}} rotel > rotel-agent
rm ${{matrix.build.ARTIFACT}}
chmod +x rotel-agent
ls
cd npm
# set the binary name
bin="rotel-agent"
# derive the OS and architecture from the build matrix name
# note: when split by a hyphen, first part is the OS and the second is the architecture
node_os=$(echo "${{ matrix.build.NAME }}" | cut -d '-' -f1)
export node_os
node_arch=$(echo "${{ matrix.build.NAME }}" | cut -d '-' -f2)
export node_arch
# set the version
export node_version="${{ env.RELEASE_VERSION }}"
# set the package name
export node_pkg="@streamfold/rotel-${node_os}-${node_arch}"
export node_pkg_dir="rotel-${node_os}-${node_arch}"
# create the package directory
mkdir -p "${node_pkg_dir}/bin"
# generate package.json from the template
envsubst < package.json.tmpl > "${node_pkg_dir}/package.json"
# copy the binary into the package
cp ../rotel-agent "${node_pkg_dir}/bin"
cd "${node_pkg_dir}"
publish-npm-base:
name: Publish the base NPM package
needs: publish-npm-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18.19.0"
registry-url: "https://registry.npmjs.org"
- name: Publish the package
shell: bash
run: |
cd npm/app
yarn install # requires optional dependencies to be present in the registry
npm test
yarn build
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}