-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (76 loc) · 2.3 KB
/
ci.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
name: discord-faucet CI
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ '*' ]
jobs:
hadolint:
runs-on: ubuntu-20.04
name: "Hadolint"
steps:
- uses: actions/checkout@v2
- uses: jbergstroem/hadolint-gh-action@v1
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- uses: ciiiii/toml-editor@1.0.0
- name: Prepare config.toml File
run: cp config.toml.template config.toml
- name: Edit Config.toml File Database Path
with:
file: "config.toml"
key: "database.path"
value: ${{ secrets.DATABASE_PATH }}
- name: Edit Config.toml File Discord Channel
with:
file: "config.toml"
key: "discord.channel_id"
value: ${{ secrets.DISCORD_CHANNEL_ID }}
- name: Edit Config.toml File Discord Token
with:
file: "config.toml"
key: "discord.token"
value: ${{ secrets.DISCORD_TOKEN }}
- name: Edit Config File Sender Endpoint
with:
file: "config.toml"
key: "sender.endpoint"
value: ${{ secrets.SENDER_ENDPOINT }}
- name: Edit Config File Sender Seed
with:
file: "config.toml"
key: "sender.seed"
value: ${{ secrets.SENDER_SEED }}
- name: Copy File via SSH to Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "config.toml"
target: "~/discord-faucet"
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and publish
run: |
# If it is a tag:
if [ -z "${GITHUB_REF##refs/tags/*}" ] ; then
./scripts/docker-hub-publish.sh ${GITHUB_REF#refs/tags/}
else
./scripts/docker-hub-publish.sh ${GITHUB_SHA}
fi