From ca4117882ef1797f972bbe9db527056c7aeab965 Mon Sep 17 00:00:00 2001 From: "d.lawrynowicz" Date: Fri, 18 Aug 2023 12:38:22 +0200 Subject: [PATCH] Feature/remove increase version pipeline (#115) (#116) * Feature/remove increase version pipeline (#115) * Add tag based releases * Add tests steps * trigger lint and tests on merge * npm command * Fix tests command * add --passWithNoTests to tests in pipeline * Remove test execution - we dont have tests here --- .github/workflows/increment-version.yml | 41 ----------- .../{lint.yml => lint-and-tests.yml} | 12 +++- .github/workflows/release-npm-package.yml | 68 +++++++++++++++++++ .github/workflows/release-package.yml | 25 ------- 4 files changed, 77 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/increment-version.yml rename .github/workflows/{lint.yml => lint-and-tests.yml} (63%) create mode 100644 .github/workflows/release-npm-package.yml delete mode 100644 .github/workflows/release-package.yml diff --git a/.github/workflows/increment-version.yml b/.github/workflows/increment-version.yml deleted file mode 100644 index ec7b8b2..0000000 --- a/.github/workflows/increment-version.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Increment version and create release - -on: - workflow_dispatch: - inputs: - version: - description: 'New version number' - required: true - -jobs: - version_bump: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.TESTERLOOP_ACCESS_TOKEN }} - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Configure Git - uses: fregante/setup-git-user@v2 - - name: Update package version - run: npm version ${{ github.event.inputs.version }} - - name: Push changes - run: git push --follow-tags origin ${{ github.ref }} - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v3 - env: - GITHUB_TOKEN: ${{ secrets.TESTERLOOP_ACCESS_TOKEN }} - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.TESTERLOOP_ACCESS_TOKEN }} - with: - tag_name: ${{ github.event.inputs.version }} - release_name: ${{ github.event.inputs.version }} - body: ${{ steps.github_release.outputs.changelog }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint-and-tests.yml similarity index 63% rename from .github/workflows/lint.yml rename to .github/workflows/lint-and-tests.yml index 5df5035..35360d4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint-and-tests.yml @@ -1,13 +1,17 @@ -name: Lint +name: Lint and tests on: + push: + branches: + - master + - multitenant pull_request: branches: - master - multitenant jobs: - lint: + lintAndTests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,4 +19,6 @@ jobs: with: node-version: '18.x' - run: npm install - - run: npm run lint + + - name: Run linter + run: npm run lint diff --git a/.github/workflows/release-npm-package.yml b/.github/workflows/release-npm-package.yml new file mode 100644 index 0000000..0666d68 --- /dev/null +++ b/.github/workflows/release-npm-package.yml @@ -0,0 +1,68 @@ +name: Build & Publish Testerloop CLI NPM Package + +on: + workflow_dispatch: + push: + tags: + - '*' + +env: + NEW_VERSION: ${{ github.ref_name }} +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm ci + + - name: Run linter + run: npm run lint + + publish-npm: + needs: tests + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + steps: + - uses: actions/checkout@v3 + + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.TESTERLOOP_ACCESS_TOKEN }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.TESTERLOOP_ACCESS_TOKEN }} + with: + tag_name: ${{ env.NEW_VERSION }} + release_name: ${{ env.NEW_VERSION }} + body: ${{ steps.github_release.outputs.changelog }} + + - uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm run build + - name: Login to GitHub Package Registry + run: echo "//npm.pkg.github.com/:_authToken=${{secrets.secrets.NPM_TOKEN}}" >> ~/.npmrc + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Send Slack notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_MESSAGE: | + Build & Publish Testerloop CLI Package workflow completed. + + Latest Release: *[ ${{ env.NEW_VERSION }} ]* (https://github.com/${{ github.repository }}/releases/${{ env.NEW_VERSION }}) diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml deleted file mode 100644 index f17fb9f..0000000 --- a/.github/workflows/release-package.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build & Publish Testerloop Server Package - -on: - release: - types: [created] - -jobs: - publish-gpr: - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - registry-url: https://npm.pkg.github.com/ - - run: | - npm ci - npm run build - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}