1.0.14 #38
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: CI Build & Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Validate commit messages | |
run: | | |
npx --no-install commitlint --from=$(git rev-list --max-parents=0 HEAD) --to=HEAD | |
- name: Lint code | |
run: npm run lint | |
- name: Run jsdom tests | |
run: npm run test | |
- name: Run coverage | |
run: npm run test:coverage | |
release: | |
needs: build | |
runs-on: ubuntu-22.04 | |
if: ${{ needs.build.result == 'success' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Git configuration | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npm run build | |
- name: Configure NPM registry | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Check NPM Version | |
run: | | |
CURRENT_VERSION=$(npm view ignite-element version) | |
PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
if [ "$CURRENT_VERSION" = "$PACKAGE_VERSION" ]; then | |
echo "Version $CURRENT_VERSION already published. Bump to next version." | |
exit 0 | |
fi | |
- name: Generate changelog and bump version | |
run: npm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push changes and tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git push origin main --follow-tags |