Skip to content

Commit

Permalink
Add workflows for ks build and heroku deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
rockymountainhigh1943 committed Oct 17, 2023
1 parent ca3b297 commit 38e463a
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Helpful Doc Links
# Workflow syntax - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Context and expression syntax - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions

name: Main

on:
push:
branches:
- main

jobs:
deploy:
name: Deploy
if: github.ref == 'refs/heads/main'
needs: [build]
runs-on: ubuntu-latest
env:
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_GIT_URL: ${{ secrets.HEROKU_GIT_URL }}
steps:
- uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags - needed for `auto`
fetch-depth: 0
ref: main
- name: write auth
run: |
cat > ~/.netrc <<EOF
machine git.heroku.com
login $HEROKU_EMAIL
password $HEROKU_API_KEY
EOF
- name: git push to heroku for deploy
run: |
git remote add heroku $HEROKU_GIT_URL
git push heroku main
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Use actions/checkout@v2
uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags - needed for `auto`
# Default: 1
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Handle Cache
uses: actions/cache@v2
# https://github.com/actions/cache/blob/master/examples.md#node---lerna
id: cache # use this to check for `cache-hit` (`steps.cache.outputs.cache-hit != 'true'`)
with:
path: |
node_modules
**/node_modules
~/.cache/yarn
key: node-deps-${{ hashFiles('yarn.lock') }}
# restore-keys: node-deps-
- name: Install Deps
if: steps.cache.outputs.cache-hit != 'true'
run: |
yarn cache clean
yarn install --cache-folder ~/.cache/yarn --prefer-offline --frozen-lockfile --force-node-version=16
env:
CYPRESS_INSTALL_BINARY: 0 # skipping big Cypress binary download. may cause problems later & need to remove or handle other ways. trying to keep CI speedy
- name: Run Full Build
run: yarn build
- name: Run Knapsack Test
run: yarn ks:test
49 changes: 49 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: PR

on:
pull_request:
branches:
- main

jobs:
build:
name: Build & Release
needs: [cypress-run]
runs-on: ubuntu-latest
steps:
- name: Use actions/checkout@v2
uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags - needed for `auto`
# Default: 1
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Handle Cache
uses: actions/cache@v2
# https://github.com/actions/cache/blob/master/examples.md#node---lerna
id: cache # use this to check for `cache-hit` (`steps.cache.outputs.cache-hit != 'true'`)
with:
path: |
node_modules
**/node_modules
~/.cache/yarn
key: node-deps-${{ hashFiles('yarn.lock') }}
# restore-keys: node-deps-
- name: Install Deps
if: steps.cache.outputs.cache-hit != 'true'
# This command clears the cache before installing dependences
run: |
yarn cache clean
yarn install --cache-folder ~/.cache/yarn --prefer-offline --frozen-lockfile --force-node-version=16
env:
CYPRESS_INSTALL_BINARY: 0 # skipping big Cypress binary download. may cause problems later & need to remove or handle other ways. trying to keep CI speedy
- name: Run Full Build
run: yarn build
- name: Run Knapsack Test
run: yarn ks:test

0 comments on commit 38e463a

Please sign in to comment.