diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index ce9bd0f..e69de29 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -1,49 +0,0 @@ -name: deploy demo - -on: - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - 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 }} - deploy: - needs: sonarcloud - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages - permissions: - contents: read - pages: write - id-token: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - run: npm install - - run: npm run build-all -- --base-href jquery-chart - - uses: actions/configure-pages@v5 - - uses: actions/upload-pages-artifact@v3 - with: - path: './dist/jquery-charts' - - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3622721..110d09a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,20 @@ -name: publish libraries +name: CI/CD on: - release: - types: ["published"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - + pull_request: + branches: main + types: [opened, synchronize, reopened] + push: + branches: main jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - registry-url: 'https://registry.npmjs.org' - scope: '@oneteme' - - run: npm install - - run: npm run build '@oneteme/jquery-core' - - run: npm config ls - - run: npm publish ./dist/oneteme/jquery-core --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npm run build '@oneteme/jquery-apexcharts' - - run: npm publish ./dist/oneteme/jquery-apexcharts --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: oneteme/automation-scripts/.github/actions/sonar-npm-scan@main #see package.json: scripts.build + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a2336ce --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: tag release +on: + workflow_dispatch: + inputs: + core: + type: boolean + description: deploy jquery-core library + apexcharts: + type: boolean + description: deploy jquery-apexcharts library +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: oneteme/automation-scripts/.github/actions/sonar-npm-scan@main + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + scope: '@oneteme' + - uses: oneteme/automation-scripts/.github/actions/npm-deploy@main + if: ${{ inputs.core }} + with: + package: 'jqeury-core' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - uses: oneteme/automation-scripts/.github/actions/npm-deploy@main + if: ${{ inputs.apexcharts }} + with: + package: 'jqeury-apexcharts' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - uses: oneteme/automation-scripts/.github/actions/npm-project-version@main + id: prj_ver + outputs: # take global project version + version: ${{ steps.prj_ver.outputs.version }} + release: + needs: deploy + runs-on: ubuntu-latest + steps: + - uses: oneteme/automation-scripts/.github/actions/create-release-notes@main + with: + version: ${{ needs.deploy.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 1e108ff..99f6da2 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,7 @@ "scripts": { "ng": "ng", "start": "ng serve", - "build": "ng build", - "build-all": "ng build \"@oneteme/jquery-core\" && npm run build \"@oneteme/jquery-apexcharts\" && ng build", + "build": "ng build \"@oneteme/jquery-core\" && ng build \"@oneteme/jquery-apexcharts\" && ng build", "watch": "ng build --watch --configuration development", "test": "ng test" },