forked from eliasbakken/Kamikaze2
-
Notifications
You must be signed in to change notification settings - Fork 18
107 lines (106 loc) · 4.18 KB
/
main.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
name: Build Refactor on AWS
on: push
jobs:
build-recore-octoprint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Refactor Recore with OctoPrint on AWS
uses: garygrossgarten/github-action-ssh@release
with:
command: |
cd Refactor
git fetch
export branch=$(echo ${{github.ref}} | cut -d'/' -f 3-)
git reset --hard
git checkout --force $branch
git pull
git log HEAD --oneline --no-walk
rm -rf Refactor-*.xz
ls armbian*.img.xz | grep -v $(date +"%F") | xargs -d"\n" rm -rf
sudo ./build-image-in-chroot-end-to-end.sh recore
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
privateKey: ${{ secrets.PRIVATE_KEY}}
env:
CI: true
- name: Download file via SSH if tagged
uses: nicklasfrahm/scp-action@main
if: startsWith(github.ref, 'refs/tags/')
with:
direction: download
host: ${{ secrets.HOST }}
fingerprint: ${{ secrets.EC2_FINGERPRINT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: /home/admin/Refactor/Refactor-recore-latest.img.xz
target: ./Refactor-recore-octoprint-latest.img.xz
- name: Rename file
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=$(git log -n1 --pretty="format:%d" | sed "s/, /\n/g" | grep tag: | grep -v origin | sed "s/tag: \|)//g" | tr -d '\n')
if [[ $TAG == "" ]]; then
TAG=$(git reflog --decorate -1 | awk -F' ' '{print $1}' | tr -d '\n')
fi
DATE=$(date --iso-8601)
mv ./Refactor-recore-octoprint-latest.img.xz Refactor-recore-octoprint-${TAG}-${DATE}.img.xz
- name: Release if tagged
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
allowUpdates: true
artifacts: Refactor-recore-octoprint-*.img.xz
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
build-recore-mainsail:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Refactor Recore with Mainsail on AWS
uses: garygrossgarten/github-action-ssh@release
with:
command: |
cd Refactor
git fetch
export branch=$(echo ${{github.ref}} | cut -d'/' -f 3-)
git reset --hard
git checkout --force $branch
git pull
git log HEAD --oneline --no-walk
rm -rf Refactor-*.xz
sudo ./build-image-in-chroot-end-to-end.sh recore SYSTEM_klipper_mainsail-DEFAULT.yml
host: ${{ secrets.HOST_REPLICAPE }}
username: ${{ secrets.USERNAME }}
privateKey: ${{ secrets.PRIVATE_KEY}}
env:
CI: true
- name: Download file via SSH if tagged
uses: nicklasfrahm/scp-action@main
if: startsWith(github.ref, 'refs/tags/')
with:
direction: download
host: ${{ secrets.HOST_REPLICAPE }}
fingerprint: ${{ secrets.EC2_FINGERPRINT_REPLICAPE }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: /home/admin/Refactor/Refactor-recore-latest.img.xz
target: ./Refactor-recore-mainsail-latest.img.xz
- name: Rename file if tagged
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=$(git log -n1 --pretty="format:%d" | sed "s/, /\n/g" | grep tag: | grep -v origin | sed "s/tag: \|)//g" | tr -d '\n')
if [[ $TAG == "" ]]; then
TAG=$(git reflog --decorate -1 | awk -F' ' '{print $1}' | tr -d '\n')
fi
DATE=$(date --iso-8601)
mv ./Refactor-recore-mainsail-latest.img.xz Refactor-recore-mainsail-${TAG}-${DATE}.img.xz
- name: Release if tagged
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
allowUpdates: true
artifacts: Refactor-recore-mainsail-*.img.xz
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true