Skip to content

Merge pull request #5 from Eslam3bed/add-badges #3

Merge pull request #5 from Eslam3bed/add-badges

Merge pull request #5 from Eslam3bed/add-badges #3

Workflow file for this run

name: Build and Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
- name: Build the package
run: npm run build
- name: Bump version and generate changelog
run: |
git config --global user.name 'Eslam3bed'
git config --global user.email '[email protected]'
npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changelog and version bump
id: commit_version
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Check if there are any changes to commit
if ! git diff --quiet; then
git add .
git commit -m "chore(release): $(node -p -e "require('./package.json').version") [skip ci]"
git tag v$(node -p -e "require('./package.json').version")
echo "version_bumped=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "version_bumped=false" >> $GITHUB_OUTPUT
fi
- name: Push changes to main branch
if: ${{ steps.tag.outputs.version_bumped }} == 'true'
run: |
git checkout main
git push origin main --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}