-
Notifications
You must be signed in to change notification settings - Fork 4
124 lines (122 loc) · 3.17 KB
/
Index.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
name: Build, Index, Push & Deploy
on:
push:
branches:
- main
- development
paths:
- "Source/Tools/**"
- "Packages/**"
pull_request:
branches:
- main
- development
paths:
- "Source/Tools/**"
- "Packages/**"
workflow_dispatch:
workflow_call:
secrets:
DEPLOY_HOST:
required: true
DEPLOY_USERNAME:
required: true
DEPLOY_KEY:
required: true
DEPLOY_FOLDER:
required: true
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v4
- name: Cache Tools
id: cache-tools
uses: actions/cache@v3
env:
cache-name: cache-tools
with:
path: ./Source/Tools/index
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./Source/Tools/**') }}
- name: Install Dependencies
if: steps.cache-tools.outputs.cache-hit != 'true'
run: sudo apt-get install -y libssl-dev pkg-config
- name: Build
if: steps.cache-tools.outputs.cache-hit != 'true'
working-directory: ./Source/Tools
run: |
cargo build --package ficsit-networks-repository-tools --bin index --verbose --release
- name: Prepare Upload
if: steps.cache-tools.outputs.cache-hit != 'true'
working-directory: ./Source
run: |
cp target/release/index ./Tools
- name: Upload Tools
uses: actions/upload-artifact@v4
with:
name: Tools
path: |
./Source/Tools/index
index:
needs: build
runs-on: ubuntu-latest
name: Index
steps:
- uses: actions/checkout@v4
- name: Download Tools
uses: actions/download-artifact@v4
with:
name: Tools
path: ./Tools
- name: Prepare Tools
run: chmod 770 ./Tools -R
- name: Run Index
run: ./Tools/index
- name: Upload Index
uses: actions/upload-artifact@v4
with:
name: Index
path: |
./index.zip
push-index:
needs: index
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
name: Push Index
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: index
- name: Download Index
uses: actions/download-artifact@v4
with:
name: Index
path: .
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Commit
run: |
git add index.zip
git commit -m "Update Index"
- name: Push
run: |
git push
deploy:
needs: push-index
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Docker Compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
cd ${{ secrets.DEPLOY_FOLDER }}
podman-compose up -d --force-recreate