Skip to content

Commit

Permalink
Adds automation for deploying acceptance and production (#123)
Browse files Browse the repository at this point in the history
* Adds automation for deploying acceptance and production

* Adds README docs

* Removes restart requirement
  • Loading branch information
vanny96 authored Feb 28, 2025
1 parent 2645b1b commit 4da5555
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/deploy_acceptance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Deploy Acceptance

on:
workflow_dispatch: {}

jobs:
deploy_acceptance:
uses: ./.github/workflows/deploy_template.yaml
with:
target_branch: 'acceptance'
source_branch: 'main'
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/deploy_production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Deploy Production

on:
workflow_dispatch: {}

jobs:
deploy_acceptance:
uses: ./.github/workflows/deploy_template.yaml
with:
target_branch: 'production'
source_branch: 'acceptance'
secrets: inherit
36 changes: 36 additions & 0 deletions .github/workflows/deploy_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Template

on:
workflow_call:
inputs:
source_branch:
type: string
required: true
description: Source Branch
target_branch:
type: string
required: true
description: Target Branch
jobs:
deploy:
name: Deploy ${{ inputs.target_branch }}
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
name: Generate GitHub Token
id: app-token
with:
app-id: ${{ secrets.LUNATECH_BLOG_APP_ID }}
private-key: ${{ secrets.LUNATECH_BLOG_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: '0'

- name: Merge from ${{ inputs.source_branch }} to ${{ inputs.target_branch }}
run: |
git fetch origin
git checkout ${{ inputs.target_branch }}
git rebase origin/${{ inputs.source_branch }}
git push origin ${{ inputs.target_branch }}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ You can modify the template in the `app/views/` directory.
## Starting the application

`sbt run` and go in your browser to `http:localhost:9000`

# How to deploy a new version

Merging your PR will update the `main` branch only. You'll need to deploy it first in
[Acceptance](https://blog.acceptance.lunatech.com/), and then in [Production](https://blog.lunatech.com/).

You can do both with the help of GitHub Actions:
* [Deploy Acceptance](https://github.com/lunatech-labs/lunatech-blog-engine/actions/workflows/deploy_acceptance.yaml)
* [Deploy Production](https://github.com/lunatech-labs/lunatech-blog-engine/actions/workflows/deploy_production.yaml)


0 comments on commit 4da5555

Please sign in to comment.