Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds automation for deploying acceptance and production #123

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ 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)

For the time being, the blog engine needs to be manually restarted in clever cloud as well. Please ask your colleagues
if you don't know how to do that.