Skip to content

Instantly share code, notes, and snippets.

Last active October 9, 2022 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olich97/5ba50f83f008d483ab8215ef09b84d10 to your computer and use it in GitHub Desktop.
Save olich97/5ba50f83f008d483ab8215ef09b84d10 to your computer and use it in GitHub Desktop.
name: deploy-production
# Controls when the action will run. Triggers the workflow on push
# events but only for the main/master branch
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# This workflow contains a single job called "deploy-production"
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
# Checks-out your repository under $GITHUB_WORKSPACE with submodules
- name: Checkout
uses: actions/checkout@v2
submodules: recursive
# Initiate deployment status
- name: Start Deployment
uses: bobheadxi/deployments@v0.4.3
id: deployment
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Production
# Install Hugo (specific version)
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
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
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()
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