ci: Fix create release #16
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: Build React Library | |
on: | |
push: | |
branches: [ main, Storybook ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '23' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build library | |
run: | | |
npm run generate:css | |
ls -al | |
npm run build | |
# Create .gitignore file excluding dist folder | |
echo -e "!dist\n!dist/*" >> .gitignore | |
- name: Commit built files | |
run: | | |
cat .gitignore | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
# Add dist folder contents | |
git add dist/ | |
# Only commit if there are changes | |
if git diff --cached --quiet ; then | |
echo "No changes in dist folder" | |
else | |
git commit -m "Automated build: Update dist folder" | |
git push origin Storybook | |
fi | |
version-tag: | |
needs: build | |
if: needs.build.result == 'success' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: prepare | |
run: echo ignore_merge_commits = true" > cog.toml | |
- name: Create Version Tag | |
uses: cocogitto/cocogitto-action@v3 | |
with: | |
release: true | |
git-user: 'Cocogitto bot' | |
check-latest-tag-only: true |