Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions .github/workflows/release_deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy release

on:
# useful for (manually) deploying test/draft releases
# Manually deploy a release candidate for testing in a staging environment.
workflow_dispatch:

push:
Expand All @@ -14,7 +14,10 @@ jobs:
env:
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
MIX_ENV: prod
DATABASE_URL: ${{ secrets.DATABASE_URL }}
# Dummy DATABASE_URL used when building a release. Otherwise, runtime.exs
# is complaining. But actually, we have no need to connect to the database
# while building a release.
DATABASE_URL: "ecto://USER:PASS@HOST/DATABASE"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -71,6 +74,6 @@ jobs:
- name: Activate new release
if: github.event_name == 'push'
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} "cd ${{ secrets.DEPLOY_PATH_RELEASES }}; ./${{ env.release }}/bin/migrate; rm current; ln -s ${{ env.release }}/ current; ${{ secrets.DEPLOY_RESTART_SERVER }}"
ssh -o StrictHostKeyChecking=no -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} "cd ${{ secrets.DEPLOY_PATH_RELEASES }}; rm current; ln -s ${{ env.release }}/ current; ${{ secrets.DEPLOY_RESTART_SERVER }}"
env:
release: cklist-${{ steps.info.outputs.version }}-${{ steps.info.outputs.git-hash }}
6 changes: 5 additions & 1 deletion dev_docs/release-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ In (slightly) more detail:

1. When a pull request is opened, various tests run.
2. Pull requests can only be merged, when all tests pass (and the version number is updated).
3. Upon merge, a release (with the new version number) is built and automatically deployed to [cklist.org](cklist.org).
3. Upon merge, a release (with the new version number) is built and automatically deployed to [cklist.org](cklist.org). Migrations are configured to run as part of `ExecStartPre` in the service file definition.

The repository is configured such that tests need to pass and run against the latest[^1] version of `main`. A [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) might be used in the future to avoid congestion when multiple developers work at the same time. Merge queues require an organization. We might move there anyway once we have multiple people contribute.

## Release candidates

The release & deploy workflow can be triggered manually, which will deploy a release candidate to [rc.cklist.org](https://rc.cklist.org). Release candidates operate in a staging environment with a separate database. The mailserver configuration is shared.
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Cklist.MixProject do
def project do
[
app: :cklist,
version: "0.0.9",
version: "0.0.10",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down