diff --git a/.github/workflows/deploy_acceptance.yaml b/.github/workflows/deploy_acceptance.yaml new file mode 100644 index 0000000..06aa97d --- /dev/null +++ b/.github/workflows/deploy_acceptance.yaml @@ -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 diff --git a/.github/workflows/deploy_production.yaml b/.github/workflows/deploy_production.yaml new file mode 100644 index 0000000..bfed44b --- /dev/null +++ b/.github/workflows/deploy_production.yaml @@ -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 diff --git a/.github/workflows/deploy_template.yaml b/.github/workflows/deploy_template.yaml new file mode 100644 index 0000000..8839cc5 --- /dev/null +++ b/.github/workflows/deploy_template.yaml @@ -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 }} diff --git a/README.md b/README.md index 55ff0a9..3b480e6 100644 --- a/README.md +++ b/README.md @@ -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) + +