-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (149 loc) · 5.12 KB
/
ci.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Deploy Site
on:
push:
branches:
- dev
- main
jobs:
prod:
if: github.ref =='refs/heads/main' && !contains(github.event.head_commit.message, '!noci')
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20.12.1'
cache: 'npm'
- name: Public IP
id: ip
uses: candidob/[email protected]
- name: Setup Linode Cloud Firewall
uses: linode/action-linode-cli@v1
with:
token: "${{ secrets.LINODE_CLI_TOKEN }}"
- name: build prod
id: build
run: |
wget -O ./public/testimonials.json ${{ secrets.TESTIMONIAL_JSON_URL }}
sed -i -e 's#{GA-ID}#'${{ secrets.GOOGLE_ANALYTICS_ID }}'#g' ./src/layouts/DefaultLayout.astro
npm install
npm run build
- name: Setup SSH
id: ssh-setup
run: |
mkdir ~/.ssh
touch ~/.ssh/known_hosts
echo ${{ secrets.LINODEFINGERPRINT }} >> ~/.ssh/known_hosts
- name: Open Linode Cloud Firewall for GH
if: (steps.ssh-setup.outcome == 'success')
id: linode-fw-open
env:
PUB_IP: "${{ steps.ip.outputs.ipv4 }}/32"
HOME_IP: "${{ secrets.HOMEIP }}"
LINODE_FW_ID: "${{ secrets.LINODE_FW_ID }}"
run: |
wget https://raw.githubusercontent.com/alexandzors/utils/main/linode-scripts/linode.sh
bash ./linode.sh -a --verbose
- name: deploy site
uses: burnett01/[email protected]
id: deploy
with:
switches: -avr
path: ./dist/
remote_path: /opt/sites/agnet/
remote_host: ${{ secrets.LINODEHOST }}
remote_port: 22
remote_user: ${{ secrets.LINODEUSER }}
remote_key: ${{ secrets.LINODESSHKEY }}
- name: Close Linode Cloud Firewall for GH
if: always()
id: linode-fw-close
env:
PUB_IP: "${{ steps.ip.outputs.ipv4 }}/32"
HOME_IP: "${{ secrets.HOMEIP }}"
LINODE_FW_ID: "${{ secrets.LINODE_FW_ID }}"
run: |
bash ./linode.sh -d --verbose
dev:
if: github.ref =='refs/heads/dev' && !contains(github.event.head_commit.message, '!noci')
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20.12.1'
cache: 'npm'
- name: Public IP
id: ip
uses: candidob/[email protected]
- name: Setup Linode Cloud Firewall
uses: linode/action-linode-cli@v1
with:
token: "${{ secrets.LINODE_CLI_TOKEN }}"
- name: build dev
id: build
run: |
sed -i -e 's#alexsguardian.net#dev.alexsugardian.net#g' ./src/components/SiteMeta.astro
sed -i '51i \ \ \ \ <Announcement />' ./src/layouts/DefaultLayout.astro
npm install
npm run build:dev
- name: htmlproofer test
uses: chabad360/htmlproofer@master
id: html-testing
with:
directory: "./dist/"
arguments: --disable-external --checks --allow-hash-href --ignore_urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
# - name: psi mobile test
# uses: stefafafan/psi-action@v1
# id: psi-m-testing
# with:
# url: "https://dev.alexsguardian.net"
# strategy: mobile
# key: ${{ secrets.PS_KEY }}
# - name: psi desktop test
# uses: stefafafan/psi-action@v1
# id: psi-d-testing
# with:
# url: "https://dev.alexsguardian.net"
# strategy: desktop
# key: ${{ secrets.PS_KEY }}
- name: Setup SSH
id: ssh-setup
run: |
mkdir ~/.ssh
touch ~/.ssh/known_hosts
echo ${{ secrets.LINODEFINGERPRINT }} >> ~/.ssh/known_hosts
- name: Open Linode Cloud Firewall for GH
if: (steps.ssh-setup.outcome == 'success')
id: linode-fw-open
env:
PUB_IP: "${{ steps.ip.outputs.ipv4 }}/32"
HOME_IP: "${{ secrets.HOMEIP }}"
LINODE_FW_ID: "${{ secrets.LINODE_FW_ID }}"
run: |
wget https://raw.githubusercontent.com/alexandzors/utils/main/linode-scripts/linode.sh
bash ./linode.sh -a --verbose
- name: deploy site
uses: burnett01/[email protected]
id: deploy
with:
switches: -avr
path: ./dist/
remote_path: /opt/sites/agnet-dev/
remote_host: ${{ secrets.LINODEHOST }}
remote_port: 22
remote_user: ${{ secrets.LINODEUSER }}
remote_key: ${{ secrets.LINODESSHKEY }}
- name: Close Linode Cloud Firewall for GH
if: always()
id: linode-fw-close
env:
PUB_IP: "${{ steps.ip.outputs.ipv4 }}/32"
HOME_IP: "${{ secrets.HOMEIP }}"
LINODE_FW_ID: "${{ secrets.LINODE_FW_ID }}"
run: |
bash ./linode.sh -d --verbose