From a6f270e7267bb8f094fb7e8d3dd91f0fd21ef13f Mon Sep 17 00:00:00 2001 From: Pawel Gierlasinski Date: Mon, 3 Jul 2023 14:16:02 +0200 Subject: [PATCH 1/5] chore(REACH-550): prepare github release workflow --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ .travis.yml | 31 --------------------- 2 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bb11184 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + branches: [main] + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + token: ${{ secrets.GH_TOKEN }} + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Get yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: | + **/node_modules + ~/.cache + key: ${{ runner.os }}-node-16-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('.github/workflows/**.yml') }} + + - name: Install Node.js dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile + + - run: yarn lint + + - run: yarn test:unit + - run: (yarn server &) && sleep 1 && yarn test:integration + + - run: yarn build + - run: yarn semantic-release + + - uses: 8398a7/action-slack@v3 + if: failure() + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action + env: + SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0e60d74..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: node_js -node_js: - - '12' - -branches: - only: - - main - -cache: - directories: - - node_modules - -notifications: - email: false - -env: - VERSION: '$TRAVIS_BUILD_NUMBER' - -before_install: - - yarn - -before_script: - - yarn server & - -script: - - yarn lint - - yarn test:unit - - yarn test:integration - -after_success: - - yarn run semantic-release From cf85887be3355239a60a44b0fdd2dfeff7b411dc Mon Sep 17 00:00:00 2001 From: Pawel Gierlasinski Date: Mon, 3 Jul 2023 15:54:13 +0200 Subject: [PATCH 2/5] chore(REACH-550): add beta release --- .github/workflows/release.yml | 7 ++++++- package.json | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb11184..e6dfc85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,9 @@ name: Release on: push: - branches: [main] + branches: + - main + - beta jobs: release: @@ -41,6 +43,9 @@ jobs: - run: yarn build - run: yarn semantic-release + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - uses: 8398a7/action-slack@v3 if: failure() diff --git a/package.json b/package.json index 321b07d..eced77d 100644 --- a/package.json +++ b/package.json @@ -101,6 +101,14 @@ } }, "release": { + "branches": [ + "+([0-9])?(.{+([0-9]),x}).x", + "main", + { + "name": "beta", + "prerelease": true + } + ], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", From 8174abd34808675a7039abaa34de5b288bd74da3 Mon Sep 17 00:00:00 2001 From: Pawel Gierlasinski Date: Mon, 3 Jul 2023 16:12:40 +0200 Subject: [PATCH 3/5] fix(REACH-550): remove slack notification --- .github/workflows/release.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6dfc85..7e8d9be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,12 +45,4 @@ jobs: - run: yarn semantic-release env: GH_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - - uses: 8398a7/action-slack@v3 - if: failure() - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action - env: - SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file From 94b1732d705dfa740bb4705f3bea59b17a3b5831 Mon Sep 17 00:00:00 2001 From: Pawel Gierlasinski Date: Tue, 4 Jul 2023 10:59:43 +0200 Subject: [PATCH 4/5] chore(REACH-550): test on prs and pushes, release only on main and beta --- .github/workflows/{release.yml => build.yml} | 6 ++++++ package.json | 12 ------------ 2 files changed, 6 insertions(+), 12 deletions(-) rename .github/workflows/{release.yml => build.yml} (88%) diff --git a/.github/workflows/release.yml b/.github/workflows/build.yml similarity index 88% rename from .github/workflows/release.yml rename to .github/workflows/build.yml index 7e8d9be..3367303 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Release on: + pull_request: + branches: + - main + push: branches: - main @@ -42,7 +46,9 @@ jobs: - run: (yarn server &) && sleep 1 && yarn test:integration - run: yarn build + - run: yarn semantic-release + if: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/beta') }} env: GH_TOKEN: ${{ secrets.GH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index eced77d..36d10aa 100644 --- a/package.json +++ b/package.json @@ -108,18 +108,6 @@ "name": "beta", "prerelease": true } - ], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm", - [ - "@semantic-release/exec", - { - "successCmd": "yarn run publish:github" - } - ], - "@semantic-release/github" ] } } From d0eace47b63651b2e8dfa4f33db953dcc830a912 Mon Sep 17 00:00:00 2001 From: Pawel Gierlasinski Date: Tue, 4 Jul 2023 11:03:14 +0200 Subject: [PATCH 5/5] chore(REACH-550): rename workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3367303..48c9d94 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Release +name: Build on: pull_request: