From 8cf28662cb977db14cf7ca413b14bc7771247430 Mon Sep 17 00:00:00 2001 From: Marin Petrunic Date: Tue, 10 May 2022 13:10:29 +0200 Subject: [PATCH] update cd action --- .github/.dependabot.yml | 8 +++ .github/workflows/main.yml | 33 +++++++++++ .github/workflows/release.yml | 92 ------------------------------- .github/workflows/semantic-pr.yml | 24 ++++++++ 4 files changed, 65 insertions(+), 92 deletions(-) create mode 100644 .github/.dependabot.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/semantic-pr.yml diff --git a/.github/.dependabot.yml b/.github/.dependabot.yml new file mode 100644 index 00000000..0ce6b57d --- /dev/null +++ b/.github/.dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "npm" + allow: + # Allow both direct and indirect updates for all packages + - dependency-type: "production" + commit-message: + prefix: "chore: " \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f57a8dd1..bb4eed06 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,3 +58,36 @@ jobs: - run: npm install - run: npm run prebuild - run: npx aegir test -t browser -t webworker --bail -- --browser firefox -- --exit + maybe-release: + name: release + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + needs: [check, test-node, test-chrome, test-firefox] + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: node + package-name: release-please-action + changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' + + - uses: actions/checkout@v3 + if: ${{ steps.release.outputs.release_created }} + + - uses: actions/setup-node@v3 + with: + cache: 'npm' + node-version: 16 + registry-url: 'https://registry.npmjs.org' + if: ${{ steps.release.outputs.release_created }} + + - run: npm install + if: ${{ steps.release.outputs.release_created }} + + - run: npm run build + if: ${{ steps.release.outputs.release_created }} + + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} + if: ${{ steps.release.outputs.release_created }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 250f970e..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Release - -on: - push: - branches: - - 'master' - - '0.11.x' - -jobs: - tag: - name: Check and Tag - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Create tag - id: tag - uses: butlerlogic/action-autotag@1.1.1 - with: - GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - strategy: package # Optional, since "package" is the default strategy - tag_prefix: 'v' - outputs: - tag: ${{ steps.tag.outputs.tagname }} - version: ${{ steps.tag.outputs.version }} - - publish: - name: Publish - runs-on: ubuntu-latest - needs: tag - if: ${{ needs.tag.outputs.tag != ''}} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Setup Nodejs - uses: actions/setup-node@v1 - with: - node-version: '16' - always-auth: true - registry-url: 'https://registry.npmjs.org' - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - name: Install dependencies - run: yarn install --frozen-lockfile --non-interactive - - - name: Build packages - run: yarn run build - - - name: Publish packages - # manual switch to latest - run: yarn publish --ignore-scripts --no-git-tag-version --no-commit-hooks --non-interactive --tag beta - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - - name: Generate changelog - id: changelog - uses: heinrichreimer/github-changelog-generator-action@v2.2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issues: 'false' - pullRequests: 'true' - prWoLabels: 'true' - author: 'true' - usernamesAsGithubLogins: 'true' - compareLink: 'true' - filterByMilestone: 'false' - unreleased: 'false' - sinceTag: '${{ needs.tag.outputs.previous_tag }}' - maxIssues: '0' - stripGeneratorNotice: 'true' - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ needs.tag.outputs.tag }} - body_path: 'CHANGELOG.md' - release_name: Release ${{ needs.tag.outputs.tag }} - prerelease: false # Note: if prerelease, will be hidden from view in the main page - - # in case of failure - - name: Rollback on failure - if: failure() - uses: author/action-rollback@9ec72a6af74774e00343c6de3e946b0901c23013 - with: - id: ${{ steps.create_release.outputs.id }} - tag: ${{ needs.tag.outputs.tag }} - delete_orphan_tag: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 00000000..63ebc9c7 --- /dev/null +++ b/.github/workflows/semantic-pr.yml @@ -0,0 +1,24 @@ +name: "Semantic PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + fix + feat + chore + validateSingleCommit: true #single commit can ovveride squash merge commit message + validateSingleCommitMatchesPrTitle: false \ No newline at end of file