upgrade_jssm #120
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
name: Update underlying JSSM | |
on: [repository_dispatch] | |
jobs: | |
remote-invoked-build: | |
strategy: | |
matrix: | |
include: | |
- node-version: 18.x # fastest, so run first, to error fast | |
os: ubuntu-latest | |
- node-version: 18.x # slowest, so run next. sort by slowest from here to get earliest end through parallelism | |
os: macos-latest | |
# - node-version: 18.x # finish check big-3 on latest current | |
# os: windows-latest | |
- node-version: 10.x # lastly check just ubuntu on historic node versions because speed, oldest (slowest) first | |
os: ubuntu-latest | |
- node-version: 11.x | |
os: ubuntu-latest | |
- node-version: 12.x | |
os: ubuntu-latest | |
- node-version: 13.x | |
os: ubuntu-latest | |
- node-version: 14.x | |
os: ubuntu-latest | |
- node-version: 15.x | |
os: ubuntu-latest | |
- node-version: 16.x | |
os: ubuntu-latest | |
- node-version: 17.x | |
os: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Node ${{ matrix.node-version }} ${{ matrix.os }} remote build | |
if: github.event.action == 'upgrade_jssm' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: Remote-build | |
run: | | |
echo Identifying to Git | |
git config --global user.email "stonecypher@users.noreply.github.com" | |
git config --global user.name "John Haugeland through Github Actions" | |
echo "Attempting automated upgrade to JSSM version '${{ github.event.client_payload.lib_version }}' " | |
echo " - Installing base" | |
npm install | |
echo " - Upgrading JSSM" | |
npm uninstall --save jssm && npm install --save jssm@${{ github.event.client_payload.lib_version }} | |
echo " - Analyzing new install" | |
export NEWTAG=$(awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json) | |
echo "NEWTAG=$NEWTAG" >> $GITHUB_ENV | |
echo " * JSSM version newly installed is '${{ github.event.client_payload.lib_version }}' " | |
echo " - Updating local version" | |
npm version ${{ github.event.client_payload.lib_version }} -f | |
echo " - Running new build" | |
npm run build | |
remote-invoked-windows-build: | |
strategy: | |
matrix: | |
include: | |
- node-version: 18.x # finish check big-3 on latest current | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Node ${{ matrix.node-version }} ${{ matrix.os }} remote build | |
if: github.event.action == 'upgrade_jssm' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: Remote-build | |
run: | | |
echo Identifying to Git | |
git config --global user.email "stonecypher@users.noreply.github.com" | |
git config --global user.name "John Haugeland through Github Actions" | |
echo "Attempting automated upgrade to JSSM version '${{ github.event.client_payload.lib_version }}' " | |
echo " - Installing base" | |
npm install | |
echo " - Upgrading JSSM" | |
npm uninstall --save jssm && npm install --save jssm@${{ github.event.client_payload.lib_version }} | |
npm version ${{ github.event.client_payload.lib_version }} -f | |
echo " - Running new build" | |
npm run build | |
release: | |
needs: [remote-invoked-build, remote-invoked-windows-build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org/ | |
- name: Remote final build | |
run: | | |
echo Identifying to Git | |
git config --global user.email "stonecypher@users.noreply.github.com" | |
git config --global user.name "John Haugeland through Github Actions" | |
echo "Attempting automated upgrade to JSSM version '${{ github.event.client_payload.lib_version }}' " | |
echo " - Installing base" | |
npm install | |
echo " - Upgrading JSSM" | |
npm uninstall --save jssm && npm install --save jssm@${{ github.event.client_payload.lib_version }} | |
echo " - Analyzing new install" | |
export NEWTAG=$(awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json) | |
echo "NEWTAG=$NEWTAG" >> $GITHUB_ENV | |
echo "UPGRADETAG=${{ github.event.client_payload.lib_version }}" >> $GITHUB_ENV | |
echo " * JSSM version newly installed is '${{ github.event.client_payload.lib_version }}' " | |
echo " - Updating local version" | |
npm version ${{ github.event.client_payload.lib_version }} -f --no-git-tag-version --no-commit-hooks | |
echo " - Running new build" | |
npm run build | |
echo " - Adding package to git" | |
git diff package.json | |
git add package.json | |
echo " - Committing package to git" | |
git commit -m "Automated upgrade of jssm library to ${{ github.event.client_payload.lib_version }}" | |
echo " - Pushing package to git" | |
git push origin | |
git ls-remote --exit-code --tags origin ${{ github.event.client_payload.lib_version }} || git tag -a ${{ github.event.client_payload.lib_version }} -m "Update JSSM to ${{ github.event.client_payload.lib_version }}" | |
# git push origin --tags | |
- name: Create the release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.UPGRADETAG }} | |
release_name: ${{ env.UPGRADETAG }} | |
body_path: CHANGELOG.md | |
- name: Publish to npm | |
run: | | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.JSSM_UPGRADE_NPM_TOKEN }} | |
bump-jssm-viz-demo: | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export tag to envvars | |
run: | | |
export TAG=${{ github.event.client_payload.lib_version }} | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
- name: CURL RPC to jssm-viz-demo action | |
run: | | |
curl -X POST "https://api.github.com/repos/StoneCypher/jssm-viz-demo/dispatches" -H 'Accept: application/vnd.github.everest-preview+json' -u ${{ secrets.JSSM_UPGRADE_PERSONAL_ACCESS_TOKEN }} --data '{"event_type": "upgrade_jssm_viz", "client_payload": { "lib_version": "${{ env.TAG }}" }}' | |
bump-jssm-viz-cli: | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export tag to envvars | |
run: | | |
export TAG=${{ github.event.client_payload.lib_version }} | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
- name: CURL RPC to jssm-viz-cli action | |
run: | | |
curl -X POST "https://api.github.com/repos/StoneCypher/jssm-viz-cli/dispatches" -H 'Accept: application/vnd.github.everest-preview+json' -u ${{ secrets.JSSM_UPGRADE_PERSONAL_ACCESS_TOKEN }} --data '{"event_type": "upgrade_jssm_viz", "client_payload": { "lib_version": "${{ env.TAG }}" }}' |