Skip to content

path

path #27

Workflow file for this run

name: release
on:
push:
branches:
- main
paths:
- package/ss-button/**
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: ./package/ss-button # Adjust the path as needed
permissions:
contents: write
pull-requests: write
concurrency:
group: library-publish
cancel-in-progress: false
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version-bumped: ${{ steps.version-check.outputs.bumped }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Go to Package Directory
run: pwd
- name: Get latest git tag
id: git-tag-latest
uses: actions-ecosystem/action-get-latest-tag@v1
- name: Remove tag 'v' prefix
run: echo "GIT_VERSION=$(echo ${{ steps.git-tag-latest.outputs.tag }} | cut -c2-)" >> $GITHUB_ENV
- name: Get npm version
id: npm-version
uses: martinbeentjes/[email protected]
with:
path: package/ss-button
- name: Output versions
run: |
echo git ${{ env.GIT_VERSION }}
echo npm ${{ steps.npm-version.outputs.current-version }}
- name: Check if version is bumped
id: version-check
run: |
if [[ "${{ env.GIT_VERSION }}" == "${{ steps.npm-version.outputs.current-version }}" ]]; then
echo "Versions match. Skipping publish."
echo "bumped=false" >> $GITHUB_OUTPUT
else
echo "Versions do not match. Proceeding with publish."
echo "bumped=true" >> $GITHUB_OUTPUT
fi
build-and-publish:
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.version-bumped == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Go to Package Directory
run: pwd
- name: Setup Node
uses: actions/setup-node@v4
- name: Get npm version
id: npm-tag
uses: martinbeentjes/[email protected]
with:
path: package/ss-button
- name: Install Dependencies
run: npm cache clean --force && npm install
# - name: Linter Checks
# run: npm run lint
# working-directory: package/ss-button/
- name: Build Library
run: npm run build
# - name: Release Please GitHub Action
# uses: googleapis/release-please-action@v4
# id: release
# with:
# release-type: node
# token: ${{ secrets.GITHUB_TOKEN }}
# working-directory: package/ss-button/
- name: Publish Shared Components to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_WORKFLOW }}
- name: Create git tag
uses: rickstaa/action-create-tag@v1
with:
tag: v${{ steps.npm-tag.outputs.current-version }}