Skip to content

build(deps-dev): bump the eslint-and-prettier group across 1 director… #261

build(deps-dev): bump the eslint-and-prettier group across 1 director…

build(deps-dev): bump the eslint-and-prettier group across 1 director… #261

Workflow file for this run

name: CICD
on: [push]
jobs:
Validate:
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v4.1.7
with:
persist-credentials: false
fetch-depth: 0
- name: Set Up NodeJs
uses: actions/setup-node@v4.0.2
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Cache Deployment
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: actions/cache@v4.0.2
env:
cache-name: deployment-cache
with:
path: './**/*'
key: ${{ github.event.after }}
CheckRelease:
needs: Validate
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Load Deployment
uses: actions/cache@v4.0.2
env:
cache-name: deployment-cache
with:
path: './**/*'
key: ${{ github.event.after }}
- name: Check PR Labels
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npm run release:check
Deploy:
needs: CheckRelease
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Load Deployment
uses: actions/cache@v4.0.2
env:
cache-name: deployment-cache
with:
path: './**/*'
key: ${{ github.event.after }}
- name: Configure Git
env:
GH_EMAIL: ${{ secrets.GH_EMAIL }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER: ${{ secrets.GH_USER }}
run: |
git config --local user.name "$GH_USER"
git config --local user.email "$GH_EMAIL"
git remote set-url origin "https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY"
- name: Validate Git Connection
run: |
git ls-remote origin > /dev/null
- name: Create Git Release
run: |
npm run release
- name: Push Git Release
run: |
git push --follow-tags origin $GITHUB_REF
- name: Configure NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
- name: Publish NPM Package
id: publish
run: |
npm publish
- name: Publish Release Notes
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npm run release:post
- name: Revert Git Release
if: failure() && steps.publish.outcome == 'failure'
run: |
NEW_TAG=$(git tag --points-at HEAD)
git tag -d $NEW_TAG
git push --delete origin $NEW_TAG
git revert --no-commit HEAD
git commit -m "chore(release): Reverts failed publish $NEW_TAG [skip ci]"
git push origin $GITHUB_REF