Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
development.yml
name: Development workflow
on:
push:
branches:
- develop
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: Setup Netlify access
env:
SITE_ACCESS_USER: ${{ secrets.SITE_ACCESS_USER }}
SITE_ACCESS_PASSWORD: ${{ secrets.SITE_ACCESS_PASSWORD }}
shell: bash
run: sed -i.bak "s/SITE_ACCESS_USER:SITE_ACCESS_PASSWORD/$SITE_ACCESS_USER:$SITE_ACCESS_PASSWORD/g" $(pwd)/public/_headers && rm $(pwd)/public/_headers.bak
- name: Setup Netlify environment variables
env:
VUE_APP_ENDPOINT_URL: ${{ secrets.VUE_APP_ENDPOINT_URL_DEV }}
VUE_APP_LOCAL_STORAGE_PREFIX: ${{ secrets.VUE_APP_LOCAL_STORAGE_PREFIX }}
VUE_APP_CRYPT_KEY: ${{ secrets.VUE_APP_CRYPT_KEY }}
shell: bash
run: |
echo VUE_APP_ENDPOINT_URL=$VUE_APP_ENDPOINT_URL >> .env
echo VUE_APP_LOCAL_STORAGE_PREFIX=$VUE_APP_LOCAL_STORAGE_PREFIX >> .env
echo VUE_APP_CRYPT_KEY=$VUE_APP_CRYPT_KEY >> .env
- 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