Skip to content

Commit

Permalink
Extract deployment to reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
textbook committed Jul 18, 2023
1 parent 4233f1d commit 53acc9a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to Heroku

on:
workflow_dispatch:
inputs:
environment:
required: true
type: string
url:
required: true
type: string

jobs:
deploy-heroku:
runs-on: ubuntu-22.04
environment:
name: ${{ inputs.environment }}
url: ${{ inputs.url }}
steps:
- uses: actions/checkout@v3
- uses: akhileshns/heroku-deploy@v3.12.14
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ vars.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
22 changes: 11 additions & 11 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Node.js CI
on:
push:
branches:
- main
- '*'
pull_request:
branches:
- main
Expand All @@ -25,8 +25,10 @@ jobs:
CYPRESS_INSTALL_BINARY: 0
- run: npm run lint
- run: npm run test
env:
FORCE_COLOR: true
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v3
- uses: docker/build-push-action@v4
with:
build-args: |
NODE_RELEASE=${{ steps.nvmrc.outputs.NODE_VERSION }}
Expand All @@ -44,14 +46,16 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm run test
env:
FORCE_COLOR: true
- run: npm run e2e
- run: npm run e2e:dev
e2e:
runs-on: ubuntu-22.04
needs: build
strategy:
matrix:
node: [ '16', '18', '20' ]
node: [ '16.17', '16', '18.3', '18', '20' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -62,15 +66,11 @@ jobs:
- run: npm run e2e
- run: npm run e2e:dev
deploy:
runs-on: ubuntu-22.04
uses: './.github/workflows/deploy.yml'
if: github.ref == 'refs/heads/main'
needs:
- e2e
- windows
steps:
- uses: actions/checkout@v3
- uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: starter-kit-ci
heroku_email: ${{ secrets.HEROKU_EMAIL }}
with:
environment: heroku
url: https://starter-kit-ci.herokuapp.com/

0 comments on commit 53acc9a

Please sign in to comment.