Cache node modules, update Vercel Action version, and notify team of … #12
This file contains 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 to Vercel | |
on: | |
push: | |
branches: | |
- main | |
- feature/** | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Vercel Action | |
uses: amondnet/vercel-action@v25.1.1 # Ensure this points to the latest or a specific version that works for you | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
team-id: ${{ secrets.TEAM_ID_VERCEL }} | |
project-id: ${{ secrets.PROJECT_ID_VERCEL }} | |
vercel-args: ${{ github.ref == 'refs/heads/main' && '--prod' || '' }} | |
- name: Notify team of deployment | |
if: always() # This ensures the step runs whether the previous step succeeded or failed | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |