Skip to content

🚀 Create Release and Deploy #34

🚀 Create Release and Deploy

🚀 Create Release and Deploy #34

name: 🚀 Create Release and Deploy
on: workflow_dispatch
jobs:
lint:
name: 🔎 Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'main'
- name: Setup node env
uses: actions/[email protected]
with:
node-version: 18.16.0
- name: Install dependencies
run: npm ci
- name: Run lint
run: npm run lint
test:
name: 🧪 Unit Tests
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v2
with:
ref: 'main'
- name: Setup node env
uses: actions/[email protected]
with:
node-version: 18.16.0
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
version-deploy:
name: 🚀 Version and Deploy
needs:
- lint
runs-on: ubuntu-latest
environment:
name: production
url: https://equitableexplorer.planning.nyc.gov
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NEXT_PUBLIC_CARTO_USERNAME: ${{ secrets.CARTO_USERNAME }}
NEXT_PUBLIC_CARTO_API_KEY: ${{ secrets.CARTO_API_KEY }}
NEXT_PUBLIC_MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
NEXT_PUBLIC_DO_SPACE_URL: ${{ secrets.DO_SPACE_URL }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
FROM_EDDE_EMAIL: ${{ secrets.FROM_EDDE_EMAIL }}
TO_EDDE_EMAIL: ${{ secrets.TO_EDDE_EMAIL }}
NEWSLETTER_ENDPOINT: ${{ secrets.NEWSLETTER_ENDPOINT }}
NEWSLETTER_LIST_ID: ${{secrets.NEWSLETTER_LIST_ID}}
steps:
- uses: actions/checkout@v2
with:
ref: 'main'
persist-credentials: false
- name: Setup node env
uses: actions/[email protected]
with:
node-version: 18.16.0
- name: Install dependencies
run: npm ci
- name: Version NPM Package
env:
SERVICE_ACCOUNT_NAME: ${{ secrets.SERVICE_ACCOUNT_NAME }}
SERVICE_ACCOUNT_EMAIL: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
run: |
git config --local user.name "$SERVICE_ACCOUNT_NAME"
git config --local user.email "$SERVICE_ACCOUNT_EMAIL"
npm version patch -m "version %s" --commit-hooks false
git push https://${{ secrets.SERVICE_ACCOUNT_NAME }}:${{ secrets.SERVICE_ACCOUNT_PAT }}@github.com/${{ github.repository }}.git HEAD:main --follow-tags
- name: Deploy to Production
run: |
echo "FROM_EDDE_EMAIL=$FROM_EDDE_EMAIL" >> .env
echo "TO_EDDE_EMAIL=$TO_EDDE_EMAIL" >> .env
echo "SENDGRID_API_KEY=$SENDGRID_API_KEY" >> .env
echo "NEWSLETTER_ENDPOINT=$NEWSLETTER_ENDPOINT" >> .env
echo "NEWSLETTER_LIST_ID=$NEWSLETTER_LIST_ID" >> .env
npx netlify-cli deploy --build --prod