Skip to content

Commit

Permalink
Merge pull request #5 from josh-stillman/js/downmerge-dev
Browse files Browse the repository at this point in the history
Js/downmerge dev with reusable workflow
  • Loading branch information
josh-stillman authored Sep 7, 2023
2 parents 9c3263d + e8371b6 commit d131533
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 15 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/main.yml → .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
name: Deploy Next.js site to AWS

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "frontend"
cancel-in-progress: false
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
# Build job
build-and-deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
NEXT_PUBLIC_API_URL: ${{ secrets.API_URL }}
steps:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy FE to DEV

on:
# Runs on pushes targeting the default branch
push:
branches: ["dev"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "frontend-dev"
cancel-in-progress: false

jobs:
build-deploy-dev:
uses: ./.github/workflows/build-deploy.yml
secrets: inherit
with:
environment: dev

23 changes: 23 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy FE to PROD

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "frontend-prod"
cancel-in-progress: false

jobs:
build-deploy-dev:
uses: ./.github/workflows/build-deploy.yml
secrets: inherit
with:
environment: production

2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function Home() {

<Link href="/foobar">go to foobar page!</Link>
</div>

<h2>we are in PROD!</h2>
<NewsFeed />
</main>
);
Expand Down

0 comments on commit d131533

Please sign in to comment.