All checks were successful
Deploy / deploy (push) Successful in 13s
- Add inputs block to workflow_dispatch so Gitea shows the Run button - Skip version bump on manual triggers to allow redeployment without bumping - Fall back to VERSION file for APP_VERSION on manual runs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
reason:
|
|
description: "Reason for manual deploy"
|
|
required: false
|
|
default: "manual"
|
|
|
|
env:
|
|
COMPOSE_PROJECT: outline-sync
|
|
COMPOSE_FILE: docker-compose.yml
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Bump patch version
|
|
if: github.event_name != 'workflow_dispatch'
|
|
run: |
|
|
VERSION=$(cat VERSION)
|
|
MAJOR=$(echo $VERSION | cut -d. -f1)
|
|
MINOR=$(echo $VERSION | cut -d. -f2)
|
|
PATCH=$(echo $VERSION | cut -d. -f3)
|
|
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
|
echo $NEW_VERSION > VERSION
|
|
echo "APP_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
|
git config user.email "ci@domverse-berlin.eu"
|
|
git config user.name "CI"
|
|
git add VERSION
|
|
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
|
|
git push
|
|
|
|
- name: Write .env
|
|
run: |
|
|
cat > .env << EOF
|
|
OUTLINE_URL=http://outline:3000
|
|
OUTLINE_TOKEN=${{ secrets.OUTLINE_TOKEN }}
|
|
TS_AUTHKEY=${{ secrets.TS_AUTHKEY }}
|
|
EOF
|
|
|
|
- name: Deploy with docker compose
|
|
run: |
|
|
APP_VERSION=${APP_VERSION:-$(cat VERSION)}
|
|
echo "=== Deploying $APP_VERSION (commit ${{ gitea.sha }}) to ${{ gitea.ref_name }} ==="
|
|
docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" build --build-arg APP_VERSION=$APP_VERSION
|
|
docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" up -d --remove-orphans
|
|
|
|
- name: Prune dangling images
|
|
run: docker image prune -f
|
|
|
|
- name: Show running containers
|
|
run: docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" ps
|