Skip to content

ci: deploy using railway cli #44

ci: deploy using railway cli

ci: deploy using railway cli #44

Workflow file for this run

name: πŸš€ Deploy
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: πŸš€ Deploy
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: βŽ” Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: πŸ“₯ Install dependencies
run: npm i -g @railway/cli
- name: πŸš€ Deploy
run: railway up
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
purge:
name: ♻️ Purge Cloudflare cache
runs-on: ubuntu-latest
needs: deploy
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: βŽ” Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: πŸ“₯ Install dependencies
uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: πŸ“¦ Build current commit
run: |
pnpm run build
mv ./build ./current
- name: πŸ“¦ Build previous commit
run: |
git checkout HEAD^
pnpm install --frozen-lockfile --strict-peer-dependencies
pnpm run build
mv ./build ./previous
- name: πŸ“ Generate diff
id: diff
run: |
if [ -z "$(diff -qr ./current ./previous)" ]; then
echo "has_diff=false" >> $GITHUB_OUTPUT
else
echo "has_diff=true" >> $GITHUB_OUTPUT
fi
- name: ♻️ Purge Cloudflare cache
uses: jakejarvis/cloudflare-purge-action@v0.3.0
if: steps.diff.outputs.has_diff == 'true'
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
PURGE_URLS: '["https://www.mcan.sh", "https://www.mcan.sh/resume", "https://www.mcan.sh/resume.pdf"]'