-
Notifications
You must be signed in to change notification settings - Fork 22
81 lines (69 loc) · 2.17 KB
/
Copy pathdeploy.yml
File metadata and controls
81 lines (69 loc) · 2.17 KB
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
81
name: Deploy
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master]
workflow_dispatch:
concurrency:
group: production-deploy
cancel-in-progress: false
permissions:
contents: read
jobs:
deploy:
name: Production
if: >-
github.repository == 'csa-admin-org/csa-admin' &&
(
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name == github.repository)
)
runs-on: ubuntu-24.04-arm
timeout-minutes: 45
environment: production
env:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
ADMIN_KEY: ${{ secrets.CAP_ADMIN_KEY }}
steps:
- name: Check secrets
run: |
if [ -z "${RAILS_MASTER_KEY:-}" ] || [ -z "${ADMIN_KEY:-}" ]; then
echo "Missing GitHub Environment secrets on 'production'."
echo "Set RAILS_MASTER_KEY, CAP_ADMIN_KEY, and KAMAL_SSH_PRIVATE_KEY."
exit 1
fi
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
persist-credentials: false
- name: Setup Ruby
uses: jdx/mise-action@v4
env:
MISE_AQUA_GITHUB_ATTESTATIONS: false
MISE_DISABLE_TOOLS: node,aube,actionlint
- name: Install Kamal
run: |
kamal_version="$(awk '/^ kamal \(/ { gsub(/[()]/, "", $2); print $2; exit }' Gemfile.lock)"
gem install kamal -v "$kamal_version"
- name: Setup SSH
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ secrets.KAMAL_SSH_PRIVATE_KEY }}
- name: Trust isle
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
{
echo "Host *"
echo " StrictHostKeyChecking no"
echo " CheckHostIP no"
echo " UserKnownHostsFile /dev/null"
} > ~/.ssh/config
chmod 600 ~/.ssh/config
- name: Deploy
run: |
echo "Deploying $(git rev-parse HEAD)"
kamal deploy