fix: sync persist data #149
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 & Publish | |
on: | |
push: | |
branches: [ prod, staging ] | |
env: | |
NODE_VERSION: 20.10.0 | |
ENABLE_CACHE: yes | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }}-prepare | |
cancel-in-progress: true | |
outputs: | |
node-version: ${{ steps.variable.outputs.node-version }} | |
enable-cache: ${{ steps.variable.outputs.enable-cache }} | |
steps: | |
- name: Define variables | |
id: variable | |
run: | | |
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT | |
echo "enable-cache=$ENABLE_CACHE" >> $GITHUB_OUTPUT | |
release: | |
needs: [prepare] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ needs.prepare.outputs.node-version }} | |
cache: ${{ needs.prepare.outputs.enable-cache == 'yes' && 'npm' || '' }} | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Typescript check | |
run: npm run ts:check | |
- name: Check eslint | |
run: npm run lint:check | |
- name: Test | |
run: npm run test -- --coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-lcov | |
path: coverage | |
- name: Build | |
run: | | |
npm pkg delete scripts.prepare | |
npm run build | |
- name: Publish npm packages / create github release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
sonarcube: | |
runs-on: ubuntu-latest | |
needs: [release] | |
concurrency: | |
group: ${{ github.ref }}-sonarcube | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-lcov | |
path: coverage | |
- id: package-version | |
run: npx @lomray/microservices-cli package-version | |
- uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }} | |
with: | |
args: > | |
-Dsonar.projectVersion=${{ steps.package-version.outputs.version }} |