Merge pull request #54 from BrainhackWestern/2025 #269
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: | |
- master | |
- main | |
schedule: | |
- cron: "24 7 * 8-12 *" # at 3:24 every day from August to December (or 2:24 depending on daylight savings) | |
jobs: | |
check-yaml: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: fabasoad/[email protected] | |
id: jsonyaml | |
with: | |
input: 'config.yaml' | |
from: 'yaml' | |
to: 'json' | |
- name: Save yaml schema | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: config.json | |
contents: ${{ steps.jsonyaml.outputs.output }} | |
write-mode: overwrite | |
- name: Validate JSON | |
uses: docker://orrosenblatt/validate-json-action:latest | |
with: | |
entrypoint: node | |
args: /service/lib/main.js | |
env: | |
INPUT_SCHEMA: './public/schemas/brainhack-config.json' | |
INPUT_JSONS: './config.json' | |
deploy: | |
runs-on: ubuntu-latest | |
needs: check-yaml | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: npm install | |
- name: Update env for production | |
env: | |
REPO_NAME: ${{ github.event.repository.name }} | |
run: | | |
if [[ $REPO_NAME == 'BrainhackWestern.github.io' ]]; then | |
echo NEXT_PUBLIC_URL='' > .env.production.local | |
echo NEXT_PUBLIC_MAPS_EMBED_API_KEY=AIzaSyAfZCgUDCHkwhPMwFnT2xl1DdnyZmR334Q >> .env.production.local | |
echo NEXT_IMAGE_LOADER_URL=https://brainhack-western.imgix.net/ >> .env.production.local | |
echo NEXT_PUBLIC_LOADER='./src/lib/image-loaders/imgix.ts' >> .env.production.local | |
echo Running on Production | |
else | |
echo Running on stage | |
fi | |
- name: Compile email templates | |
run: npx ts-node emails/render.ts | |
- name: Build App | |
uses: nick-fields/retry@v2 | |
env: | |
EXPORT_APP: true | |
with: | |
timeout_minutes: 30 | |
retry_on: error | |
max_attempts: "${{ github.event_name == 'schedule' && 3 || 1}}" | |
command: npm run gh-build | |
- name: Push git subdirectory as branch | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: gh-pages | |
FOLDER: out | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SQUASH_HISTORY: true |