From 84d1289272d760b5034853a76e63223c10985e83 Mon Sep 17 00:00:00 2001 From: ThomasAribart Date: Thu, 29 Aug 2024 16:12:14 +0200 Subject: [PATCH] improve actions workflows --- .../draft-or-update-next-release.yml | 8 ++-- .github/workflows/release.yml | 48 ++++++++++++------- .github/workflows/test-pr.yml | 16 ++++--- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/.github/workflows/draft-or-update-next-release.yml b/.github/workflows/draft-or-update-next-release.yml index f16e2a0..06614a2 100644 --- a/.github/workflows/draft-or-update-next-release.yml +++ b/.github/workflows/draft-or-update-next-release.yml @@ -8,12 +8,14 @@ on: jobs: draft-or-update-next-release: - name: 📝 Draft or update next release + name: 📝 Draft/update next release runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v1 + - name: ♻️ Checkout + uses: actions/checkout@v3 - - uses: release-drafter/release-drafter@v5 + - name: 📝 Draft/update next release + uses: release-drafter/release-drafter@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b27b61e..670ce5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,59 +9,75 @@ env: jobs: build-and-test: + name: 🎯 Run tests (Node ${{ matrix.node }} / TS ${{ matrix.typescript }}) runs-on: ubuntu-latest strategy: matrix: - node: [16, 18] - typescript: ["~4.5.5", "~4.6.4", "~4.7.4", "~4.8.3", "~4.9.5", "~5.0.4"] - name: Node ${{ matrix.node }} / TS ${{ matrix.typescript }} + node: [16, 18, 20] + typescript: + [ + "~4.6.4", + "~4.7.4", + "~4.8.3", + "~4.9.5", + "~5.0.4", + "~5.1.6", + "~5.2.2", + "~5.3.3", + "~5.4.2", + "latest", + ] steps: - - uses: actions/checkout@v3 + - name: ♻️ Checkout + uses: actions/checkout@v3 - - name: Install node_modules + - name: 🚚 Install node_modules uses: ./.github/actions/install-node-modules with: node-version: ${{ matrix.node }} typescript-version: ${{ matrix.typescript }} - - name: Run tests + - name: 🎯 Run tests run: yarn test release: + name: 🚀 Release runs-on: ubuntu-latest - name: Release needs: build-and-test steps: - - uses: actions/checkout@v3 + - name: ♻️ Checkout + uses: actions/checkout@v3 with: ref: main - - name: Install node_modules + - name: 🚚 Install node_modules uses: ./.github/actions/install-node-modules with: node-version: 18 - - name: Clear lib directory + - name: 🗑️ Clear lib directory run: rm -rf lib - - name: Clear builds directory + - name: 🗑️ Clear builds directory run: rm -rf builds - - name: Set package version + - name: 📌 Set package version run: yarn set-package-version ${{ github.event.release.tag_name }} - - name: Build + - name: 🏗️ Build run: yarn build - - name: Building deno build + - name: 🏗️ Build for Deno run: yarn rollup -c - - uses: EndBug/add-and-commit@v9.1.3 + - name: 💾 Commit Deno Build + uses: EndBug/add-and-commit@v9.1.3 with: default_author: github_actions message: "${{ github.event.release.tag_name }} release" - - uses: JS-DevTools/npm-publish@v2 + - name: 🚀 Release + uses: JS-DevTools/npm-publish@v2 with: token: ${{ secrets.NPM_TOKEN }} strategy: upgrade diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b242c4c..653b8a0 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -1,4 +1,5 @@ name: 🎯 Test PR + on: pull_request: types: [opened, reopened, synchronize] @@ -8,13 +9,13 @@ env: jobs: build-and-test: + name: 🎯 Run tests (Node ${{ matrix.node }} / TS ${{ matrix.typescript }}) runs-on: ubuntu-latest strategy: matrix: - node: [16, 18] + node: [16, 18, 20] typescript: [ - "default", "~4.6.4", "~4.7.4", "~4.8.3", @@ -24,20 +25,21 @@ jobs: "~5.2.2", "~5.3.3", "~5.4.2", + "latest", ] - name: Node ${{ matrix.node }} / TS ${{ matrix.typescript }} + timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - name: ♻️ Checkout + uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - # We need to fetch all branches and commits so that Nx affected has a base to compare against. fetch-depth: 0 - - name: Install node_modules + - name: 🚚 Install node_modules uses: ./.github/actions/install-node-modules with: node-version: ${{ matrix.node }} typescript-version: ${{ matrix.typescript }} - - name: Run tests + - name: 🎯 Run tests run: yarn test