-
-
Notifications
You must be signed in to change notification settings - Fork 320
67 lines (57 loc) · 1.9 KB
/
Copy pathdeploy.yml
File metadata and controls
67 lines (57 loc) · 1.9 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
name: Deploy
on: [workflow_dispatch]
jobs:
deploy:
name: Deploy my app
runs-on: self-hosted
steps:
- uses: actions/checkout@v6
- name: Extract ngrok url
run: |
echo "NGROK_URL=$(curl -s localhost:4040/api/tunnels | jq -r ".tunnels[0].public_url")" >> $GITHUB_ENV
curl -s localhost:4040/api/tunnels | jq ".tunnels[0].public_url"
cat "$GITHUB_ENV"
- uses: chrnorm/deployment-action@v2
name: Create GitHub deployment
id: deployment
with:
token: '${{ github.token }}'
environment-url: ${{ env.NGROK_URL }}
environment: staging
- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: kill old server
run: systemctl --user stop goios
- name: compile
run: |
cd restapi
go install github.com/swaggo/swag/cmd/swag@latest
swag init
go build
- name: Deploy my app
run: |
cd restapi
cp ./restapi /home/ganjalf/
rm -rf /home/ganjalf/docs
mkdir /home/ganjalf/docs
cp -R ./docs /home/ganjalf/docs
systemctl --user start goios
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: ${{ steps.deployment.outputs.environment_url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: 'success'
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: ${{ steps.deployment.outputs.environment_url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: 'failure'