From 29776d7b6889a69c3dd540fb92269b8d3317e04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Mon, 12 Aug 2024 04:35:59 +0100 Subject: [PATCH] :green_heart: Reorganize workflows --- .github/workflows/build.yml | 58 +++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 9 ------ .github/workflows/deploy.yml | 6 ++-- .github/workflows/publish.yml | 10 +++--- 4 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..14797a5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +name: Build + +on: + push: + branches: + - main + + workflow_run: + workflows: [CI] + types: [completed] + branches: [main] + +defaults: + run: + working-directory: ./packages/ui + +permissions: + contents: read + +jobs: + build: + runs-on: ${{ matrix.os }} + if: ${{ github.event.workflow_run.conclusion == 'success' }} + continue-on-error: false + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + node: [20.16] + pnpm: [9.7.0] + name: ๐Ÿ“ฆ๏ธ Build Node-${{ matrix.node }} on ${{ matrix.os }} + + steps: + - name: ๐Ÿšš Checkout + uses: actions/checkout@v4 + + - name: โœจ Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - name: ๐Ÿ”ง Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ matrix.pnpm }} + + - name: ๐Ÿ”จ Install JavaScript dependencies + run: pnpm install + + - name: โœ… Fix code style and build for production + run: pnpm build + + - name: ๐Ÿ“‚ Upload Deno distribution files + uses: actions/upload-artifact@v4 + with: + name: deno_dist + path: packages/ui/jsr + overwrite: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0368d4e..0bcbf08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,9 +59,6 @@ jobs: with: version: ${{ matrix.pnpm }} - - name: Install JavaScript dependencies - run: pnpm install - - name: โœ… Fix code style and build for production run: make build @@ -74,9 +71,3 @@ jobs: - name: ๐Ÿงช Test features run: make test - - - name: ๐Ÿ“ฆ๏ธ Upload Deno distribution files - uses: actions/upload-artifact@v4 - with: - name: deno_dist - path: packages/ui/jsr diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dedbf92..6e7f89f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,7 +6,7 @@ on: - main workflow_run: - workflows: [CI, Publish] + workflows: [CI] types: [completed] branches: [main] @@ -41,7 +41,7 @@ jobs: - name: ๐Ÿšš Checkout the repository uses: actions/checkout@v4 - - name: ๐Ÿ“š Install, build, and upload website + - name: ๐Ÿ”จ Install, build, and upload website uses: withastro/action@v2 with: path: ./website @@ -58,6 +58,6 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - - name: ๐Ÿ“‚ Deploy to GitHub Pages + - name: ๐Ÿš€ Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6074b02..2f941f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,7 @@ on: - main workflow_run: - workflows: [CI] + workflows: [Build] types: [completed] branches: [main] @@ -32,18 +32,18 @@ jobs: operating-system: [ubuntu-latest] deno-version: [1.45] - name: ๐Ÿš€ Deploy UI to JSR using Deno ${{ matrix.deno-version }} + name: ๐ŸŽ‰ Publish to JSR using Deno ${{ matrix.deno-version }} steps: - name: ๐Ÿšš Get latest code uses: actions/checkout@v4 - - name: ๐Ÿ”จ Configure Deno + - name: ๐Ÿ”ง Configure Deno uses: denoland/setup-deno@v1 with: deno-version: ${{ matrix.deno-version }} - - name: ๐Ÿ“ฆ๏ธ Download Deno distribution files + - name: ๐Ÿ“‚ Download Deno distribution files uses: actions/download-artifact@v4 with: name: deno_dist @@ -54,5 +54,5 @@ jobs: - name: ๐Ÿšจ Fix code style run: deno task fix - - name: ๐Ÿš€ Publish to JSR + - name: ๐ŸŽ‰ Publish to JSR run: deno publish