Skip to content

remove blog post :sweat-smile: #359

remove blog post :sweat-smile:

remove blog post :sweat-smile: #359

Workflow file for this run

name: Deploy All
on:
# Rebuild project after stats have been updated
workflow_run:
workflows:
- Update Stats
- Trigger Deploy
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy-all:
name: Deploy All
runs-on: ubuntu-latest
# Used to loop through each project and deploy it
strategy:
matrix:
project: ["about", "writing", "photos", "music"]
steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Only build if there are changes in project
run: |
git reset --soft HEAD~1
if [[ `git status --porcelain ${{ matrix.project }}/` ]]; then
echo "Project changes found, building project"
echo "SHOULD_BUILD=true" >> $GITHUB_ENV
elif [[ `git status --porcelain shared/` ]]; then
echo "Changes found in shared, building each project"
echo "SHOULD_BUILD=true" >> $GITHUB_ENV
else
echo "No changes for project found in last commit"
echo "SHOULD_BUILD=false" >> $GITHUB_ENV
fi
git reset ORIG_HEAD
- name: Set up Node.js
if: ${{ env.SHOULD_BUILD == 'true' }}
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install top-level Node.js dependencies
if: ${{ env.SHOULD_BUILD == 'true' }}
run: npm i
- name: Install project-level Node.js dependencies
if: ${{ env.SHOULD_BUILD == 'true' }}
run: cd ./${{ matrix.project }} && npm i
- name: Fetch catalogue if project has one
if: ${{ env.SHOULD_BUILD == 'true' }}
env:
AWS_ID: ${{ secrets.AWS_ID }}
AWS_SECRET: ${{ secrets.AWS_SECRET }}
run: |
cd ./${{ matrix.project }}
git reset --hard
git pull
npm run update-catalogue --if-present
if [[ `git status --porcelain .` ]]; then
echo "Project has catalogue, updating it..."
git config --global user.name 'Deploy Bot'
git config --global user.email '[email protected]'
git commit -am "update catalogue via deploy action"
git push
fi
- name: Build Using Next.js Static Export
if: ${{ env.SHOULD_BUILD == 'true' }}
run: |
cd ./${{ matrix.project }} && npm run build
# Push to repo will trigger Netlify deploy action in that repo
- name: Push project build files to hosting repo
if: ${{ env.SHOULD_BUILD == 'true' }}
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: '${{ matrix.project }}/build'
destination-github-username: 'ebonsignori'
destination-repository-name: 'my-${{ matrix.project }}'
user-email: [email protected]
target-branch: main