Merge pull request #57 from danieljancar/develop #11
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 | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- 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: Move Files Out of browser Folder | |
run: | | |
mv dist/apps/frontend/browser/* dist/apps/frontend/ | |
rmdir dist/apps/frontend/browser | |
- name: Copy Social Media Preview Image | |
run: | | |
cp assets/previews/social-media-preview.png dist/apps/frontend/ | |
- name: Configure Git User | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub 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 }} |