From 23c02845eaba6ce03505a2ad4a99fbf0b37cfaaf Mon Sep 17 00:00:00 2001 From: Asif Nawaz Date: Wed, 27 Mar 2024 13:44:55 +0000 Subject: [PATCH] ci(semantic-release-replace-plugin): added workflows for semantic release replace plugin --- .../workflows/auto-merge-dependabot-pr.yml | 10 +++- .github/workflows/release.yml | 9 ++++ .../semantic-release-replace-release.yml | 43 +++++++++++++++ .../semantic-release-replace-test.yml | 52 +++++++++++++++++++ 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/semantic-release-replace-release.yml create mode 100644 .github/workflows/semantic-release-replace-test.yml diff --git a/.github/workflows/auto-merge-dependabot-pr.yml b/.github/workflows/auto-merge-dependabot-pr.yml index e0e135f..69cd54c 100644 --- a/.github/workflows/auto-merge-dependabot-pr.yml +++ b/.github/workflows/auto-merge-dependabot-pr.yml @@ -70,6 +70,13 @@ jobs: permissions: contents: read + semantic-release-replace-tests: + if: ${{ contains(inputs.repository, 'semantic-release-replace') }} + uses: ./.github/workflows/semantic-release-replace-test.yml + secrets: inherit + permissions: + contents: read + dependabot: name: Auto-merge Dependabot PR runs-on: ${{ vars.RTLDEV_MW_CI_OS }} @@ -83,7 +90,8 @@ jobs: - blesta-ispapi-tests - gulp-release-notification-plugin-tests - php-idna-translator-tests - if: ${{ github.actor == 'dependabot[bot]' && (success() || needs.perl-sdk-tests.result == 'success' || needs.python-sdk-tests.result == 'success' || needs.php-sdk-tests.result == 'success' || needs.java-sdk-tests.result == 'success' || needs.node-sdk-tests.result == 'success' || needs.go-sdk-tests.result == 'success' || needs.blesta-ispapi-tests.result == 'success' || needs.gulp-release-notification-plugin-tests.result == 'success' || needs.php-idna-translator-tests.result == 'success') }} + - semantic-release-replace-tests + if: ${{ github.actor == 'dependabot[bot]' && (success() || needs.perl-sdk-tests.result == 'success' || needs.python-sdk-tests.result == 'success' || needs.php-sdk-tests.result == 'success' || needs.java-sdk-tests.result == 'success' || needs.node-sdk-tests.result == 'success' || needs.go-sdk-tests.result == 'success' || needs.blesta-ispapi-tests.result == 'success' || needs.gulp-release-notification-plugin-tests.result == 'success' || needs.php-idna-translator-tests.result == 'success' || needs.semantic-release-replace-tests.result == 'success') }} permissions: contents: write pull-requests: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b8b2f..e397c5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,3 +87,12 @@ jobs: contents: write issues: write deployments: write + + semantic-release-replace-release: + if: ${{ contains(inputs.repository, 'semantic-release-replace') }} + uses: ./.github/workflows/semantic-release-replace-release.yml + secrets: inherit + permissions: + contents: write + issues: write + deployments: write \ No newline at end of file diff --git a/.github/workflows/semantic-release-replace-release.yml b/.github/workflows/semantic-release-replace-release.yml new file mode 100644 index 0000000..a1c37b2 --- /dev/null +++ b/.github/workflows/semantic-release-replace-release.yml @@ -0,0 +1,43 @@ +name: Release +on: + workflow_call: + +jobs: + tests: + uses: ./.github/workflows/semantic-release-replace-test.yml + secrets: inherit + permissions: + contents: read + + release: + name: Release @ ${{ vars.RTLDEV_MW_CI_OS }} + runs-on: ${{ vars.RTLDEV_MW_CI_OS }} + needs: tests + permissions: + contents: write + issues: write + deployments: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup NodeJS ${{ vars.RTLDEV_MW_CI_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: '${{ vars.RTLDEV_MW_CI_NODE_VERSION }}' + check-latest: true + cache: npm + - name: Install dependencies + run: npm ci + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.RTLDEV_MW_CI_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + TEAMS_NOTIFICATION_URI: ${{ secrets.RTLDEV_MW_CI_NOTIFICATION_URI }} + COMMIT_SHA: ${{ github.sha }} + # TODO move npm run documentation to semantic-release + run: | + npm run all + npx semantic-release \ No newline at end of file diff --git a/.github/workflows/semantic-release-replace-test.yml b/.github/workflows/semantic-release-replace-test.yml new file mode 100644 index 0000000..788d180 --- /dev/null +++ b/.github/workflows/semantic-release-replace-test.yml @@ -0,0 +1,52 @@ +name: Linting & Coverage +on: + workflow_call: + +jobs: + test: + name: 🧪 Linting + runs-on: ${{ vars.RTLDEV_MW_CI_OS }} + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Super Linter Code Base + uses: github/super-linter/slim@v5 + env: + FILTER_REGEX_INCLUDE: "/src/*" + DEFAULT_BRANCH: main + VALIDATE_TYPESCRIPT_ES: true + VALIDATE_ALL_CODEBASE: false + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + test_matrix: + strategy: + matrix: + node-version: ${{ fromJson(vars.RTLDEV_MW_CI_NODE_MATRIX) }} + + name: 🧪 Testing + runs-on: ${{ vars.RTLDEV_MW_CI_OS }} + needs: test + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - name: Build & Validation + run: | + npm ci + npm run lint + npm run test \ No newline at end of file