Skip to content

Commit

Permalink
Adds automation for deploying acceptance and production
Browse files Browse the repository at this point in the history
  • Loading branch information
vanny96 committed Feb 26, 2025
1 parent 2645b1b commit 8cbdd1f
Show file tree
Hide file tree
Showing 3 changed files with 62 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
38 changes: 38 additions & 0 deletions .github/workflows/deploy_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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 }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git fetch origin
git checkout ${{ inputs.target_branch }}
git rebase origin/${{ inputs.source_branch }}
git push origin ${{ inputs.target_branch }}

0 comments on commit 8cbdd1f

Please sign in to comment.