Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
name: deploy-production
# Controls when the action will run. Triggers the workflow on push
# events but only for the main/master branch
on:
push:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "deploy-production"
deploy-production:
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE with submodules
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
# Initiate deployment status
- name: Start Deployment
uses: bobheadxi/deployments@v0.4.3
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Production
# Install Hugo (specific version)
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.89.0'
extended: true
# Builds the site using Hugo
- name: Build
run: hugo --gc --minify --config=config.toml
# Push our generated Hugo site to Vercel
- name: Deploy to Vercel
uses: amondnet/vercel-action@v20
id: vercel-action
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
#github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} #Required
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} #Required
github-comment: false
vercel-args: '--prod'
working-directory: public
# Update deployment status
- name: Update Deployment Status
uses: bobheadxi/deployments@v0.4.3
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ steps.vercel-action.outputs.preview-url }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment