New Release (#51) #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Production Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Sync with Remote | |
run: | | |
git fetch origin master | |
git reset --hard origin/master | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install | |
- name: Install Nx CLI | |
run: npm install -g nx | |
- name: Lint Code | |
run: nx lint frontend --fix | |
# Uncomment the following block once tests are integrated | |
# - name: Run Tests | |
# run: nx test frontend --ci | |
- name: Run Semantic Release | |
id: semantic_release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Frontend | |
if: steps.semantic_release.outputs.new_release == 'true' | |
run: nx build frontend --prod --base-href https://vv.danieljancar.dev/ | |
- name: Create CNAME | |
if: steps.semantic_release.outputs.new_release == 'true' | |
run: echo "vv.danieljancar.dev" > dist/apps/frontend/CNAME | |
- name: Deploy to GitHub Pages | |
if: steps.semantic_release.outputs.new_release == 'true' | |
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 }} |