Skip to content

Merge branch 'develop' #12

Merge branch 'develop'

Merge branch 'develop' #12

Workflow file for this run

name: Collections DevOps
on:
workflow_dispatch:
push:
branches:
- '**'
permissions:
contents: read
actions: read
checks: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: false
env:
PROJECT_NAME: collections
jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm run test:jsonReporter
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: dorny/test-reporter@v1
if: always()
id: testsreport
with:
name: Unit Tests # Name of the check run which will be created
path: 'test-results.json' # Path to test results (inside artifact .zip)
reporter: mocha-json # Format of test results
- name: Notify Discord
if: always()
uses: ./.github/actions/notify-discord
with:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
projectName: ${{ env.PROJECT_NAME }}
testResultsUrl: ${{ steps.testsreport.outputs.url_html }}
sonarUrl: https://sonarcloud.io/summary/new_code?id=quinck-io_collections&branch=${{ github.ref_name }}
publish:
runs-on: ubuntu-latest
needs: qa
if: ${{ github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Publish to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
PUBLISHED_VERSION=$(npm show @quinck/collections version)
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
if [ "${PUBLISHED_VERSION}" = "${PACKAGE_VERSION}" ]; then
echo "The current package version has already been published"
else
echo "Do pubblication"
npm publish --access public
fi
- name: Notify Discord
if: always()
uses: ./.github/actions/notify-discord
with:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
projectName: ${{ env.PROJECT_NAME }}