From 02b73f2a545be1568266dfa0134c555781cf31d5 Mon Sep 17 00:00:00 2001 From: Daniel Jancar Date: Sun, 11 Aug 2024 17:14:39 +0200 Subject: [PATCH] chore: integrate semantic release and deploying to github pages --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ .releaserc.json | 22 ++++++++++++++++ apps/frontend/project.json | 4 +-- 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9f2801a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Production Release + +on: + push: + branches: + - master + +jobs: + build-deploy-release: + runs-on: ubuntu-latest + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Dependencies + run: npm install + + - name: Build Frontend + run: nx build frontend --prod --base-href https://vv.danieljancar.dev/ + + - name: Create CNAME + run: echo "vv.danieljancar.dev" > dist/apps/frontend/CNAME + + - name: Configure Git User + run: | + git config --global user.email "actions@github.com" + git config --global user.name "gh-actions[bot]" + + - name: Deploy to GitHub Pages + run: | + git init + git checkout --orphan gh-pages + git --work-tree dist/apps/frontend add --all + git --work-tree dist/apps/frontend commit -m 'Deploy' + git push -f origin gh-pages + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run Semantic Release + run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..20cd06b --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,22 @@ +{ + "branches": ["master"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": ["CHANGELOG.md", "package.json", "package-lock.json"], + "message": "chore(release): ${nextRelease.version}" + } + ] + ], + "npmPublish": false +} diff --git a/apps/frontend/project.json b/apps/frontend/project.json index 5e50840..f52eb9b 100644 --- a/apps/frontend/project.json +++ b/apps/frontend/project.json @@ -30,8 +30,8 @@ "budgets": [ { "type": "initial", - "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumWarning": "2mb", + "maximumError": "4mb" }, { "type": "anyComponentStyle",