gha-workflows/.gitea/workflows/docker-compose-deploy.yml
Renovate [BOT] 691d3c563f chore(deps): update https://git.tainton.uk/actions/pushover-action action to v1.1.3 (#23)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://git.tainton.uk/actions/pushover-action](https://git.tainton.uk/actions/pushover-action) | action | patch | `v1.1.0` -> `v1.1.3` |

---

### Release Notes

<details>
<summary>actions/pushover-action (https://git.tainton.uk/actions/pushover-action)</summary>

### [`v1.1.3`](https://git.tainton.uk/actions/pushover-action/compare/v1.1.2...v1.1.3)

[Compare Source](https://git.tainton.uk/actions/pushover-action/compare/v1.1.2...v1.1.3)

### [`v1.1.2`](https://git.tainton.uk/actions/pushover-action/compare/v1.1.1...v1.1.2)

[Compare Source](https://git.tainton.uk/actions/pushover-action/compare/v1.1.1...v1.1.2)

### [`v1.1.1`](https://git.tainton.uk/actions/pushover-action/compare/v1.1.0...v1.1.1)

[Compare Source](https://git.tainton.uk/actions/pushover-action/compare/v1.1.0...v1.1.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMTEuNCIsInVwZGF0ZWRJblZlciI6IjM5LjIxMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: #23
Co-authored-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
Co-committed-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
2025-03-23 22:15:41 +01:00

97 lines
3.4 KiB
YAML

name: Docker Compose Deploy Stack
on:
workflow_call:
secrets:
DEPLOY_HOST:
required: true
type: string
DEPLOY_USERNAME:
required: true
type: string
DEPLOY_SSHKEY:
required: true
type: string
DEPLOY_PORT:
required: true
type: string
PUSHOVER_USER_TOKEN:
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: "[ON RUNNER] Notify Build Start"
uses: https://git.tainton.uk/actions/pushover-action@v1.1.3
env:
PUSHOVER_APP_TOKEN: ${{ secrets.PUSHOVER_APP_TOKEN }}
PUSHOVER_USER_TOKEN: ${{ secrets.PUSHOVER_USER_TOKEN }}
with:
message: "Deploying stack ${{ gitea.repository }}"
title: 'Stack Deployment Started'
url: "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
url_title: 'View Logs'
- name: "[ON RUNNER] Checkout the repo"
uses: actions/checkout@v4
- name: "[ON RUNNER] Set project variables"
run: |
projectname="${{ gitea.event.repository.name }}"
echo "project_name=$projectname" >> $GITEA_ENV
echo "project_folder=/home/${{ secrets.DEPLOY_USERNAME }}/$projectname" >> $GITEA_ENV
- name: "[ON RUNNER] Create env file"
run: |
rm -f ".env"
touch ".env"
echo "$ALLVARS" | jq -r '. | to_entries[] | select(.key | startswith("DC_")) | .key + "=" + .value' >> ".env"
echo "$ALLSECRETS" | jq -r '. | to_entries[] | select(.key | startswith("DC_")) | .key + "=" + .value' >> ".env"
env:
ALLVARS: ${{ toJSON(vars) }}
ALLSECRETS: ${{ toJSON(secrets) }}
- name: "[ON HOST] Make directory if not exists"
uses: appleboy/ssh-action@v1.2.2
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_SSHKEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
mkdir -p ${{ env.project_folder }}
- name: "[ON HOST] SCP files to host"
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
port: ${{ secrets.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSHKEY }}
source: "./compose.yaml,./.env"
target: "${{ env.project_folder }}/"
- name: "[ON HOST] Deploy Stack"
uses: appleboy/ssh-action@v1.2.2
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_SSHKEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
cd ${{ env.project_folder }}
docker compose --env-file .env up --detach
- name: "[ON RUNNER] Notify Build End"
uses: https://git.tainton.uk/actions/pushover-action@v1.1.3
env:
PUSHOVER_APP_TOKEN: ${{ secrets.PUSHOVER_APP_TOKEN }}
PUSHOVER_USER_TOKEN: ${{ secrets.PUSHOVER_USER_TOKEN }}
with:
message: "Deployed stack ${{ gitea.repository }}"
title: 'Stack Deployment ${{ job.status }}'
url: "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
url_title: 'View Logs'