feat: edited lint version #2
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 Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Build Package | |
run: yarn build | |
- name: Run Lint | |
run: yarn lint | |
- name: Run Type Check | |
run: yarn type-check | |
- name: Run Tests | |
run: yarn test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: devpeneur/peekaboo-sdk | |
- name: Configure Git | |
run: | | |
git config --global user.email "p2012agarwal@gmail.com" | |
git config --global user.name "Pranav Agarwal" | |
- name: Get Current Version | |
id: get_version | |
run: | | |
current_version=$(curl -s https://api.github.com/repos/devpeneur/peekaboo-sdk/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
echo "current_version=$current_version" >> $GITHUB_OUTPUT | |
- name: Bump Version | |
id: bump_version | |
run: | | |
current_version=${{ steps.get_version.outputs.current_version }} | |
major=$(echo $current_version | cut -d '.' -f 1) | |
minor=$(echo $current_version | cut -d '.' -f 2) | |
patch=$(echo $current_version | cut -d '.' -f 3) | |
if [ $patch -eq 20 ] && [ $minor -eq 9 ]; then | |
new_major=$((major + 1)) | |
new_version="$new_major.0.0" | |
elif [ $patch -eq 20 ]; then | |
new_minor=$((minor + 1)) | |
new_version="$major.$new_minor.0" | |
else | |
new_version="$major.$minor.$((patch + 1))" | |
fi | |
echo "new_version=$new_version" >> $GITHUB_OUTPUT | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish package on NPM 📦 | |
run: yarn publish --new-version ${{ steps.bump_version.outputs.new_version }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | |
- name: Update GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.bump_version.outputs.new_version }} | |
release_name: v${{ steps.bump_version.outputs.new_version }} | |
body: | | |
Release v${{ steps.bump_version.outputs.new_version }} |