31 lines
992 B
YAML
31 lines
992 B
YAML
name: Smart Deploy
|
|
run-name: Deploying ${{ gitea.ref_name }} 🚀
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Astro Site
|
|
run: npm run build
|
|
|
|
- name: Deploy to Production
|
|
if: gitea.ref == 'refs/heads/main'
|
|
run: npx netlify-cli deploy --prod --dir=dist --site=${{ secrets.NETLIFY_SITE_ID }} --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} --message "Prod ${{ gitea.sha }}"
|
|
|
|
- name: Deploy Preview
|
|
if: gitea.ref != 'refs/heads/main'
|
|
run: |
|
|
ALIAS=$(echo "${{ gitea.ref_name }}" | tr / -)
|
|
npx netlify-cli deploy --dir=dist --alias "$ALIAS" --site=${{ secrets.NETLIFY_SITE_ID }} --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} --message "Preview $ALIAS" |