forked from ManWithBear/pobfrontend
-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (99 loc) · 4.25 KB
/
main.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
93
94
95
96
97
98
99
100
name: CI
on:
push:
branches: [ master ]
pull_request:
schedule:
- cron: '30 13 * * 5'
jobs:
build-linux-amd64:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- id: time
run: |
time=nightly-$(date +'%Y/%m/%d')
echo "time=${time}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- run: make
- name: Package tar.xz archive
run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding") | xz -c > PathOfBuilding.linux.amd64.tar.xz
- name: Cheking GUI
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
DISPLAY: :10
if: github.ref != 'refs/heads/master'
run: |
pushd ${GITHUB_WORKSPACE}/PathOfBuilding
Xvfb :10 -screen 0 1024x768x24 &
sleep 10
./PathOfBuilding &
sleep 10
xwd -root -silent -display :10 | convert xwd:- png:/tmp/sl.png
export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'`
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GIT_TOKEN}" \
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot Linux](${IMG_URL})\n${GITHUB_SHA} : Linux\"}"
popd
echo $IMG_URL
- run: tar -tvf PathOfBuilding.linux.amd64.tar.xz
- name: Update release tag
if: github.ref == 'refs/heads/master'
run: |
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "[email protected]"
git tag -f PathOfBuilding
git remote add gh https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git
git push -f gh PathOfBuilding
git remote remove gh
- name: Upload Linux artifacts into Github
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
artifacts: "PathOfBuilding.linux.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"
build-macos-amd64:
runs-on: macos-13
steps:
- id: time
run: |
time=nightly-$(date +'%Y/%m/%d')
echo "time=${time}" >> $GITHUB_OUTPUT
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- run: brew install make
- run: make
- name: Package tar.xz archive
run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.amd64.tar.xz
- name: Cheking GUI
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
if: github.ref != 'refs/heads/master'
run: |
./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh &
sleep 10
screencapture /tmp/sl.png
export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'`
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GIT_TOKEN}" \
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS\"}"
echo $IMG_URL
- run: tar -tvf PathOfBuilding.darwin.amd64.tar.xz
- name: Upload MacOS artifacts into Github
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
artifacts: "PathOfBuilding.darwin.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"