Merge pull request #105 from GTBitsOfGood/hc/103-dockerize #184
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 website | |
# On pull request, make a deployment to Preview | |
# On merge into main, make a deployment to Develop | |
# On merge into prod, flag prod, make a deployment to Production | |
on: | |
push: | |
branches: [main, production] | |
pull_request: | |
branches: [main] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Lint files and run type-checks | |
run: yarn lint | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set pipeline | |
id: pipeline | |
# if its a PR, then its for preview, else its for development or prod based on what it's being pushed to. | |
run: echo ::set-output name=pipeline::${{ github.event_name == 'pull_request' && 'Preview' || (github.ref == 'refs/heads/production' && 'Production' || 'Development') }} | |
- uses: chrnorm/deployment-action@releases/v1 | |
name: Create GitHub deployment | |
id: deployment | |
with: | |
token: "${{ github.token }}" | |
environment: ${{ steps.pipeline.outputs.pipeline }} | |
target_url: "" | |
- uses: amondnet/vercel-action@v19 | |
name: Deploy to Vercel | |
id: vercel_deploy | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required | |
github-token: ${{ secrets.GITHUB_TOKEN }} #Optional | |
vercel-args: ${{ steps.pipeline.outputs.pipeline == 'Production' && '--prod' || null}} #Optional | |
vercel-org-id: ${{ secrets.ORG_ID}} #Required | |
vercel-project-id: ${{ secrets.PROJECT_ID}} #Required | |
#working-directory: ./sub-directory #Your Working Directory, Optional | |
# alias-domains: | #Optional, for when an actual domain is provided | |
# staging.angular.vercel-action.amond.dev | |
# pr-{{PR_NUMBER}}.angular.vercel-action.amond.dev | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_url: ${{ steps.vercel_deploy.outputs.preview-url }} | |
environment_url: ${{ steps.vercel_deploy.outputs.preview-url }} | |
state: "success" | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Update deployment status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_url: ${{ steps.vercel_deploy.outputs.preview-url }} | |
environment_url: ${{ steps.vercel_deploy.outputs.preview-url }} | |
state: "failure" | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |