Skip to content

Commit

Permalink
improve actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAribart committed Aug 29, 2024
1 parent e9ac5ee commit 84d1289
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 26 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/draft-or-update-next-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
48 changes: 32 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- name: πŸ’Ύ Commit Deno Build
uses: EndBug/[email protected]
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
16 changes: 9 additions & 7 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 🎯 Test PR

on:
pull_request:
types: [opened, reopened, synchronize]
Expand All @@ -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",
Expand All @@ -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

0 comments on commit 84d1289

Please sign in to comment.