Skip to content

Instantly share code, notes, and snippets.

@itsabdessalam
Created April 18, 2020 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsabdessalam/dfd8d7a4b1edb549bb5314fc2427fe34 to your computer and use it in GitHub Desktop.
Save itsabdessalam/dfd8d7a4b1edb549bb5314fc2427fe34 to your computer and use it in GitHub Desktop.
name: Production workflow
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Get current branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: curr_branch
- name: Install Netlify CLI
run: npm install netlify-cli -g
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Run build
run: npm run build
- name: Deploy to netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
RUN_ID: ${{ github.run_id }}
CURR_BRANCH: ${{ steps.curr_branch.outputs.branch }}
shell: bash
run: netlify deploy --dir=dist --prod --auth $NETLIFY_AUTH_TOKEN --message="GitHub action deploy $RUN_ID on $CURR_BRANCH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment