-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (65 loc) · 2.55 KB
/
release.prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Release to production
on:
release:
types: [published]
jobs:
container:
runs-on: ubuntu-latest
environment: prod
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
IMAGE_NAME: ghcr.io/t0tproduction/magibot-main-${{ secrets.ENVIRONMENT }}
PROJECT_NAME: magibot-${{ secrets.ENVIRONMENT }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build containers
run: docker compose --project-name ${{ env.PROJECT_NAME }} build
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
- name: Push Docker image
run: docker push ${{ env.IMAGE_NAME }}
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Add Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Prune Leftover Docker Artifacts
run: docker system prune -af
env:
# To execute it on remote swarm
DOCKER_HOST: ssh://${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}
- name: Deploy stack
run: docker stack deploy --compose-file docker-compose.yml ${{ env.PROJECT_NAME }}
env:
# To execute it on remote swarm
DOCKER_HOST: ssh://${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}
# Env vars required to run the stack
TOKEN: ${{ secrets.TOKEN }}
OWNERID: ${{ secrets.OWNERID }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
STATCORD_TOKEN: ${{ secrets.STATCORD_TOKEN }}
APP_ID: ${{ secrets.APP_ID }}
WEBHOOK_ID_EX: ${{ secrets.WEBHOOK_ID_EX }}
WEBHOOK_TOKEN_EX: ${{ secrets.WEBHOOK_TOKEN_EX }}
WEBHOOK_ID_JOIN: ${{ secrets.WEBHOOK_ID_JOIN }}
WEBHOOK_TOKEN_JOIN: ${{ secrets.WEBHOOK_TOKEN_JOIN }}
WEBHOOK_ID_BUG: ${{ secrets.WEBHOOK_ID_BUG }}
WEBHOOK_TOKEN_BUG: ${{ secrets.WEBHOOK_TOKEN_BUG }}
WEBHOOK_ID_STARTUP: ${{ secrets.WEBHOOK_ID_STARTUP }}
WEBHOOK_TOKEN_STARTUP: ${{ secrets.WEBHOOK_TOKEN_STARTUP }}