Release #54
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
# ci_status: | |
# description: 'required CI status' | |
# default: 'success' | |
# required: true | |
# default_bump: | |
# description: patch-minor-major | |
# default: patch | |
prerelease: | |
description: prerelease name | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
solidity: [""] | |
settings: ['{"optimizer":{"enabled":true,"runs":200}}'] | |
env: | |
SOLIDITY_VERSION: ${{ matrix.solidity }} | |
SOLIDITY_SETTINGS: ${{ matrix.settings }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.7.0 | |
- uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn build | |
- run: yarn test | |
bump_version: | |
name: Bump Version | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
new_tag: ${{ steps.conventional_changelog_action.outputs.tag }} | |
changelog: ${{ steps.conventional_changelog_action.outputs.changelog }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PUBLISH_GITHUB_TOKEN }} | |
- name: Bump version and push tag | |
id: conventional_changelog_action | |
uses: TriPSs/conventional-changelog-action@v4 | |
with: | |
github-token: ${{ secrets.PUBLISH_GITHUB_TOKEN }} | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: bump_version | |
if: ${{ needs.bump_version.outputs.new_tag != null }} | |
steps: | |
# - name: Check Successful Status | |
# run: | | |
# REF_STATUS=$(curl -s \ | |
# 'https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}/status' \ | |
# | jq .state) | |
# [[ "${REF_STATUS}" == '"${{ github.event.inputs.ci_status }}"' ]] || \ | |
# (echo "::error ::${{ github.ref }} does not have a successful CI status" && false) | |
# - uses: actions/checkout@v3 | |
# with: | |
# ref: ${{ github.ref }} | |
# fetch-depth: 0 | |
# | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Create Github Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.bump_version.outputs.new_tag }} | |
release_name: Release ${{ needs.bump_version.outputs.new_tag }} | |
body: | | |
${{ needs.bump_version.outputs.changelog }} | |
- name: Configure Git | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "Github Actions" | |
- name: Merge Into Main Branch' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
PUBLISH_PRERELEASE: ${{ github.event.inputs.prerelease }} | |
if: github.event.inputs.prerelease == '' # unless it's a prerelease | |
run: | | |
git checkout main && \ | |
git merge ${{ github.ref }} && \ | |
git push | |
publish-npm: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
needs: bump_version | |
if: ${{ needs.bump_version.outputs.new_tag != null }} | |
strategy: | |
matrix: | |
solidity: [""] | |
settings: ['{"optimizer":{"enabled":true,"runs":200}}'] | |
env: | |
SOLIDITY_VERSION: ${{ matrix.solidity }} | |
SOLIDITY_SETTINGS: ${{ matrix.settings }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.7.0 | |
registry-url: https://registry.npmjs.org/ | |
always-auth: true | |
- uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |