-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (92 loc) · 3.25 KB
/
publish-website.yaml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: "Publish Website"
on:
schedule:
- cron: '0 2,14 * * *'
workflow_dispatch:
jobs:
publish-code:
runs-on: ubuntu-latest
steps:
# See documentation for the action
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GIT_SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: fail
- name: Clone repository
uses: actions/checkout@v3
with:
repository: ictunion/main-website
fetch-depth: 0
ref: main
ssh-key: ${{ secrets.GIT_SSH_KEY }}
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }}
# Nix
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Create anonymized repo
run: nix run github:ictunion/git-anonymize -- . -o /tmp/anonymized -n 'ICT Guerrilla' -e 'ictguerrilla@proton.me' -r HEAD production
- name: Publish anonymized repository
working-directory: /tmp/anonymized
run: |
git checkout main
git remote add origin git@github.com:ictunion/main-website-public.git
git push --force origin main
git push origin production:production --force
deploy-testing:
needs: publish-code
runs-on: ubuntu-latest
steps:
# See documentation for the action
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GIT_SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: fail
- name: Clone repository
uses: actions/checkout@v3
with:
repository: ictunion/main-website-public
ref: main
ssh-key: ${{ secrets.GIT_SSH_KEY }}
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }}
# Nix
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Current time
run: date +%c
- name: Build website
run: nix run . -- --baseURL=https://testing.ictunion.cz
- name: Deploy main to testing
run: |
nix-shell -p rsync --run 'rsync -rtc -I public/ website@ictunion.cz:/home/website/testing/var/www'
deploy-production:
needs: publish-code
runs-on: ubuntu-latest
steps:
# See documentation for the action
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GIT_SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: fail
- name: Clone repository
uses: actions/checkout@v3
with:
repository: ictunion/main-website-public
ref: production
ssh-key: ${{ secrets.GIT_SSH_KEY }}
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }}
# Nix
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Current time
run: date +%c
- name: Build website
run: nix run . -- --baseURL=https://ictunion.cz
- name: Deploy main to production
run: |
nix-shell -p rsync --run 'rsync -rtc public/ website@ictunion.cz:/home/website/production/var/www'