Skip to content

Release a snapshot

Release a snapshot #27

name: Release a snapshot
on:
# Only manual workflow trigger
workflow_dispatch:
inputs:
colonyNetworkHead:
description: 'colonyNetwork tag, branch or hash'
required: true
default: 'develop'
tag:
description: 'Define a custom tag for the abis'
required: true
default: 'next'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- uses: pnpm/action-setup@v4
with:
version: 8.15.8
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Cache NPM dependencies
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
- name: Checkout the desired colonyNetwork tag or branch
working-directory: ./vendor/colonyNetwork
run: git checkout ${{ github.event.inputs.colonyNetworkHead }}
- name: Install dependencies for colonyNetwork
working-directory: ./vendor/colonyNetwork
run: pnpm install --frozen-lockfile
- name: Compile colonyNetwork contracts
working-directory: ./vendor/colonyNetwork
run: npx hardhat compile
- run: pnpm run build --t=${{ github.event.inputs.tag }}
- run: pnpm test
- run: ls dist/versions/${{ github.event.inputs.colonyNetworkHead }} || ls dist/versions/next
- name: Generate version hash of abis
run: echo "VERSION_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Generate version hash of colonyNetwork
working-directory: ./vendor/colonyNetwork
run: echo "VERSION_HASH_NETWORK=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Publish package
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
npm version 0.0.0-snapshot-${{ github.event.inputs.tag }}-${{ env.VERSION_HASH }}-${{ env.VERSION_HASH_NETWORK }}-${TIMESTAMP} --no-git-tag-version
npm publish --access public --tag snapshot
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}