-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (104 loc) · 3.57 KB
/
balena-tag-release.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
108
109
110
111
112
113
114
115
116
name: Build Balena Disk Images
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
balena-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run read-yaml action
id: yaml-data
uses: jbutcher5/read-yaml@main # You may wish to replace main with a version tag such as '1.6' etc.
with:
file: "./balena.yml" # File to read from
key-path: '["version"]' # Access the runs key then the using key and retuns the value.
- name: Balena Deploy
uses: balena-labs-research/[email protected]
if: success()
with:
balena_cli_version: 17.2.2
balena_token: ${{secrets.BALENA_TOKEN}}
balena_cli_commands: |
"push ${{secrets.BALENA_FLEET}} --release-tag v${{steps.yaml-data.outputs.data}} release"
balena-build-images:
# strategy:
# matrix:
# board: ['pi3', 'pi4']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Get base board
run: |
echo "BALENA_IMAGE=raspberrypi4-64" >> $GITHUB_ENV
- name: balena CLI Action - download
uses: balena-labs-research/[email protected]
with:
balena_token: ${{secrets.BALENA_TOKEN}}
balena_cli_commands: |
os download "$BALENA_IMAGE" \
--output "$BALENA_IMAGE.img" \
--version default
balena_cli_version: 17.2.2
- name: balena CLI Action - preload
uses: balena-labs-research/[email protected]
with:
balena_token: ${{secrets.BALENA_TOKEN}}
balena_cli_commands: |
preload \
"$BALENA_IMAGE.img" \
--fleet ${{secrets.BALENA_FLEET}} \
--dont-check-arch \
--commit latest
balena_cli_version: 17.2.2
- name: balena CLI Action - configure
uses: balena-labs-research/[email protected]
with:
balena_token: ${{secrets.BALENA_TOKEN}}
balena_cli_commands: |
os configure \
"$BALENA_IMAGE.img" \
--config-network=ethernet \
--fleet ${{secrets.BALENA_FLEET}}
balena_cli_version: 17.2.2
- name: Get the Ref
id: get-ref
uses: ankitvgupta/ref-to-tag-action@master
with:
ref: ${{ github.ref }}
head_ref: ${{ github.head_ref }}
- name: Zip image
run: |
zip -9 \
"$BALENA_IMAGE-${{ steps.get-ref.outputs.tag }}.zip" \
"$BALENA_IMAGE.img"
- name: "✏️ Generate release changelog"
id: generate-changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.PAT }}
- name: Upload imgs to release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: ${{ steps.get-ref.outputs.tag }}
body: ${{ steps.generate-changelog.outputs.changelog }}
files: "*.zip"
# Cleanup
# - name: Delete workflow runs
# uses: GitRML/delete-workflow-runs@main
# with:
# retain_days: 1
# keep_minimum_runs: 3
# - name: Remove old Releases
# uses: dev-drprasad/[email protected]
# if: env.UPLOAD_RELEASE == 'true' && !cancelled()
# with:
# keep_latest: 3
# delete_tags: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}