-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (80 loc) · 2.84 KB
/
cd.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
name: release
# Controls when the workflow will run
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download rfmp
uses: robinraju/release-downloader@v1.7
with:
repository: JohnTheCoolingFan/rfmp
fileName: rfmp-linux
latest: true
- name: Get full mod file name
run: |
MFNAME=$(jq -r '.name + "_" + .version + ".zip"' info.json)
echo "MODFILENAME=$MFNAME" >> $GITHUB_ENV
- name: Pack a mod
run: |
chmod +x ./rfmp-linux
./rfmp-linux --no-clean --install-dir .
- name: Upload packed mod as an artifact
uses: actions/upload-artifact@v3.1.2
with:
name: packed-mod
path: ./${{ env.MODFILENAME }}
- name: Upload mod name as an artifact
uses: actions/upload-artifact@v3.1.2
with:
name: info-json
path: info.json
- name: Post announcement in Discord
run: curl -H 'Content-Type'':'' application/json' -d "$(echo '{"username"'':''"'"$(jq -r .name info.json)"'", "content"'':''"'"$(jq -r '"\(.name) \(.version)"' info.json)" has released'"}' | jq)" ${{ secrets.DISCORD_NEW_WEBHOOK }}
release-github:
name: Release on github
needs: build
runs-on: ubuntu-latest
steps:
- name: Download mod
uses: actions/download-artifact@v3.0.2
with:
name: packed-mod
- name: Download info.json
uses: actions/download-artifact@v3.0.2
with:
name: info-json
- name: Set up environment and file names
run: |
MFNAME=$(jq -r '.name + "_" + .version + ".zip"' info.json)
echo "MODFILENAME=$MFNAME" >> $GITHUB_ENV
- name: Upload file to release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.MODFILENAME }}
release-mod-portal:
name: Release on Mod Portal
needs: build
runs-on: ubuntu-latest
steps:
- name: Download mod
uses: actions/download-artifact@v3.0.2
with:
name: packed-mod
- name: Download info.json
uses: actions/download-artifact@v3.0.2
with:
name: info-json
- name: Set up environment and file names
run: |
MFNAME=$(jq -r '.name + "_" + .version + ".zip"' info.json)
echo "MODFILENAME=$MFNAME" >> $GITHUB_ENV
- name: Upload file to mod portal
run: |
UPLOAD_URL=$(curl -X POST -d mod="$(jq -r .name info.json)" -H "Authorization:Bearer ${{ secrets.factorio_token }}" https://mods.factorio.com/api/v2/mods/releases/init_upload | jq -r ".upload_url")
curl -X POST -s -F "file=@$MODFILENAME" $UPLOAD_URL