From 65c0a6993b0f7503c1abb887888d99798428ab5d Mon Sep 17 00:00:00 2001 From: "Mohamed E." Date: Wed, 4 Sep 2024 11:19:57 +0400 Subject: [PATCH] fix(cd): fix deploy workflow (#2) Signed-off-by: Mohamed Elkholy --- .github/workflows/main.yml | 20 ++++++++++++++------ README.md | 2 +- scripts/postbuild.mjs | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dfedb3..ab43ea9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,29 +57,37 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Get commit message + id: get_commit_message + run: | + COMMIT_MESSAGE_HEADER=$(git log -1 --pretty=%B | head -n 1 | sed "s/#/PR#/") + echo "header=${COMMIT_MESSAGE_HEADER}" >> $GITHUB_OUTPUT + - name: Cloning awesomehub/awesomehub.github.io + uses: actions/checkout@v4 with: repository: awesomehub/awesomehub.github.io token: ${{ secrets.PAT }} path: deploy - - run: rm -r deploy/dist/* + - name: Prepare repository + run: rm -r deploy/dist/* - uses: actions/download-artifact@v4 - id: download with: name: build-art path: deploy/dist - - uses: peter-evans/create-pull-request@v3 + - name: Create deploy pull request + uses: peter-evans/create-pull-request@v7 with: branch: staging path: deploy token: ${{ secrets.PAT }} - commit-message: ${{ github.event.head_commit.message }} ${{ github.event.head_commit.url }} - title: ${{ github.event.head_commit.message }} + commit-message: ${{ steps.get_commit_message.outputs.header }} ${{ github.event.head_commit.url }} + title: ${{ steps.get_commit_message.outputs.header }} body: | ## Build Information - ### Action ${{ github.workflow }} [#${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - ### Commit - ${{ github.event.head_commit.message }} ${{ github.event.head_commit.url }} + ${{ steps.get_commit_message.outputs.header }} ${{ github.event.head_commit.url }} - ### Author @${{ github.actor }} --- diff --git a/README.md b/README.md index 8acf03e..e188b6f 100755 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This repository contains the sources for AwesomeHub Angular application. > Live production build can be found at [awesomehub.js.org][website-url] ## About -The App was originaly built for educational purposes and to experiment with [Angular 2](https://v2.angular.io/), [NgRx](https://ngrx.io/) and [RxJS](https://www.learnrxjs.io/), but +The App was originally built for educational purposes and to experiment with [Angular 2](https://v2.angular.io/), [NgRx](https://ngrx.io/) and [RxJS](https://www.learnrxjs.io/), but I have recently managed to update the codebase to [Angular 12](https://v12.angular.io/), then to [Angular 18](https://angular.dev/). The App UI is built on top of the good old [Material Design Lite](https://getmdl.io/) library, It's much lighter than [Angular Material](https://material.angular.io/) diff --git a/scripts/postbuild.mjs b/scripts/postbuild.mjs index 48d2455..caf75d9 100644 --- a/scripts/postbuild.mjs +++ b/scripts/postbuild.mjs @@ -35,7 +35,7 @@ async function main() { } const headers = new Map(Object.entries(defaultHeaders)) const html = fs.readFileSync(index, { encoding: 'utf-8'}) - const matches = html.matchAll(/["']([^"'.]+\.[a-z0-9]{20})(\.(css|js))["']/gm) + const matches = html.matchAll(/["']([^"'.]+\.[a-z0-9]{16})(\.(css|js))["']/gm) for (const [, filename, ext] of matches) { const asset = filename + ext if (!headers.has(asset)) {