0.3.35 #209
Workflow file for this run
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: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: yarn | |
- name: Compare versions | |
run: | | |
current_version=$(node -p "require('./package.json').version") | |
published_version=$(npm view @dappnode/dappnodesdk version) | |
if [ "$(printf '%s\n' "$published_version" "$current_version" | sort -V | tail -n1)" != "$published_version" ]; then | |
echo "Release required" | |
echo "SHOULD_CONTINUE=true" >> $GITHUB_ENV | |
else | |
echo "No release required" | |
echo "SHOULD_CONTINUE=false" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Lint | |
if: env.SHOULD_CONTINUE == 'true' | |
run: yarn lint | |
- name: Test | |
if: env.SHOULD_CONTINUE == 'true' | |
run: yarn test | |
- name: Build | |
if: env.SHOULD_CONTINUE == 'true' | |
run: yarn build | |
- name: Get tag name | |
if: env.SHOULD_CONTINUE == 'true' | |
run: echo "TAG_NAME=v$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Create GitHub release | |
if: env.SHOULD_CONTINUE == 'true' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
release_name: ${{ env.TAG_NAME }} | |
- name: Publish to npm registry | |
if: env.SHOULD_CONTINUE == 'true' | |
run: | | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
token: ${{ secrets.NPM_TOKEN }} |