-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (145 loc) · 8 KB
/
build.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build and Release
permissions: write-all
on:
push:
branches:
- main # You can change this to match your main branch name
schedule:
- cron: '0 0 * * 1' # Run every Monday at midnight UTC
workflow_dispatch:
inputs:
version:
required: true
type: string
default: "7.14"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
channel: [stable, longterm, testing, dev, custom]
exclude:
- channel: dev
- channel: longterm
steps:
- name: Checkout code
uses: actions/checkout@v2
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
- name: Install packages into building machine
run: sudo apt-get install -y unzip qemu-utils rsync gdisk dosfstools parted genisoimage zip
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
- name: Set version if release channel name
id: get-version
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') }}
run: |
ROS7=`curl https://download.mikrotik.com/routeros/NEWESTa7.${{matrix.channel}} | awk '{print $1}'`
echo "ROSVER=$ROS7" >> $GITHUB_ENV
- name: Set version based on manually triggered build
id: get-version-custom
if: ${{ github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' }}
run: |
echo "ROSVER=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Print versions for debugging
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
run: |
echo "Build using $ROSVER"
- name: Run script to download and modify the CHR images
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
run: sudo bash build.bash $ROSVER
- name: Upload created image files as artifacts of build
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: ./chr*
- name: Push git tag to save builder's code (required for release)
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
git tag Build${{ github.run_id }}-${{matrix.channel}}
git push origin Build${{ github.run_id }}-${{matrix.channel}}
- name: Create GitHub release
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
id: create-release
uses: actions/create-release@v1 # comnoco/create-release-action@v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: Build${{ github.run_id }}-${{matrix.channel}} # ${{ github.ref }}
release_name: ${{ env.ROSVER }}
body: |
UEFI-enabled CHR images, built by GitHub
`chr-${{ env.ROSVER }}.uefi-fat.raw` for VirtIO-based hypervisors
`chr-${{ env.ROSVER }}.uefi-fat.vmdk` for VMWare (with UEFI BIOS in VMX file)
Optionally, there is a CHR "extra-packages" disk images that can be mounted to more easily add them.
For debugging, a `partition-debug--${{ env.ROSVER }}.zip` so the disk image can be viewed using Apple's tools.
*Verison:* **${{ env.ROSVER }} (${{ matrix.channel }})** [ Build ${{ github.run_id }} ]
draft: false
prerelease: true
- name: Upload CHR RAW image to release
id: upload-release-asset-raw
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-${{ env.ROSVER }}.uefi-fat.raw
asset_name: chr-${{ env.ROSVER }}.uefi-fat.raw
asset_content_type: application/octet-stream
- name: Upload CHR VMDK image to release
id: upload-release-asset-vmdk
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-${{ env.ROSVER }}.uefi-fat.vmdk
asset_name: chr-${{ env.ROSVER }}.uefi-fat.vmdk
asset_content_type: application/octet-stream
- name: Upload ZIP for debugging files on each paritition
id: upload-release-asset-partition-debug-zip
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./partition-debug-${{ env.ROSVER }}.zip
asset_name: partition-debug-${{ env.ROSVER }}.zip
asset_content_type: application/octet-stream
- name: Upload CHR extra-packages image to release (RAW)
id: upload-release-asset-extra-packages-raw
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-extra-packages-${{ env.ROSVER }}.img
asset_name: extra-packages-${{ env.ROSVER }}.img
asset_content_type: application/octet-stream
- name: Upload CHR extra-packages image to release (VMDK)
id: upload-release-asset-extra-packages-vmdk
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-extra-packages-${{ env.ROSVER }}.vmdk
asset_name: extra-packages-${{ env.ROSVER }}.vmdk
asset_content_type: application/octet-stream
- name: Upload CHR extra-packages image to release (ISO)
id: upload-release-asset-extra-packages-iso
if: ${{ (github.event_name != 'workflow_dispatch' && matrix.channel != 'custom') || ( github.event_name == 'workflow_dispatch' && matrix.channel == 'custom' )}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-extra-packages-${{ env.ROSVER }}.iso
asset_name: extra-packages-${{ env.ROSVER }}.iso
asset_content_type: application/octet-stream