chore Update yarn #7
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 Version | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
release-api: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensures tags are also fetched | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.18.2 | |
- name: Extract package version | |
run: echo "PACKAGE_VERSION=v$(cat package.json | jq -r .version)" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: | | |
yarn build-typechain | |
yarn build | |
- name: Authenticate with private NPM package | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc | |
- name: Publish to NPM | |
run: | | |
npm config set scope maplelabs | |
npm publish | |
- name: Create and Push Tag | |
env: | |
PAT: ${{ secrets.PAT }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git tag -a $PACKAGE_VERSION -m "Release $PACKAGE_VERSION" | |
git push https://x-access-token:$PAT@github.com/${{ github.repository }} $PACKAGE_VERSION | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="$tag" \ | |
--generate-notes |