Skip to content

Release

Release #180

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
tag:
type: choice
description: Tag
required: true
options:
- beta
- latest
- alpha
# pull_request:
# branches:
# - develop
# paths:
# - .github/workflows/release.yaml
# - src/**
# - bin/**
# - yarn.lock
jobs:
build-publish:
name: Build & publish
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Yarn
run: corepack enable
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Write npm credentials
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> .npmrc
npm whoami
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build
- name: Release
run: npm publish --tag ${{ github.event.inputs.tag }} --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# - name: Build packages
# run: |
# yarn pkg:build
# yarn pkg:compress
#
# - name: Get version
# id: package-version
# uses: martinbeentjes/npm-get-version-action@main
#
# - name: Tag release
# uses: tvdias/github-tagger@v0.0.1
# with:
# repo-token: ${{ github.token }}
# tag: v${{ steps.package-version.outputs.current-version }}
#
# - name: Create release page
# uses: softprops/action-gh-release@v1
# with:
# files: 'package/*'
# tag_name: v${{ steps.package-version.outputs.current-version }}
#
# - name: Checkout subsquid/homebrew-cli
# uses: actions/checkout@v3
# with:
# repository: subsquid/homebrew-cli
# path: homebrew-cli
# token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
#
# - name: Gen Formula
# run: |
# echo pkg_macos_shasum=$(shasum -a256 ./package/subsquid-cli-$npm_package_version-macos-x64.tar.gz | cut -f 1 -d " ") >> $GITHUB_ENV
# echo pkg_linux_shasum=$(shasum -a256 ./package/subsquid-cli-$npm_package_version-linux-x64.tar.gz | cut -f 1 -d " ") >> $GITHUB_ENV
# source ./homebrew-cli/gen-formula.sh
# cp sqd@$npm_package_version.rb ./homebrew-cli/Formula
# cp sqd@$version_tag.rb ./homebrew-cli/Formula
# if [ "$version_tag" = "latest" ]; then cp sqd.rb ./homebrew-cli/Formula; fi
# env:
# npm_package_version: ${{ steps.package-version.outputs.current-version }}
# version_tag: ${{ github.event.inputs.tag }}
#
# - name: Pushes to another repository
# uses: cpina/github-action-push-to-another-repository@main
# env:
# API_TOKEN_GITHUB: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
# with:
# source-directory: 'homebrew-cli'
# destination-github-username: 'subsquid'
# destination-repository-name: 'homebrew-cli'
# user-name: 'github-actions'
# user-email: 'github-actions@github.com'
# target-branch: master
# commit-message: 'release: v${{ steps.package-version.outputs.current-version }}'