Skip to content

Commit dc26156

Browse files
committed
update workflow for release
1 parent 67a6424 commit dc26156

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

.github/actions/add-version-to-channel/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ inputs:
2020
runs:
2121
using: "composite"
2222
steps:
23+
- name: Install Prerequisites
24+
shell: bash
25+
run: |
26+
pip install aiohttp cryptography
27+
pip install odrive --pre
28+
2329
- name: Register on release server
2430
shell: python
2531
run: |

.github/workflows/firmware.yaml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,29 @@ jobs:
2727
- {os: ubuntu-latest, board_version: v3.6-56V, debug: false}
2828

2929
runs-on: ${{ matrix.os }}
30+
outputs:
31+
channel: ${{ steps.release-info.outputs.channel }}
32+
version: ${{ steps.release-info.outputs.version }}
3033
steps:
3134
- uses: actions/checkout@v2
3235
with:
3336
fetch-depth: 0 # fetch entire history to get version information
3437

38+
- name: Get release name and channel
39+
id: release-info
40+
shell: python
41+
run: |
42+
if "${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/fw-v0.5.') }}" == "true":
43+
channel = "master"
44+
version = "${{ github.ref }}"[len("refs/tags/fw-v"):]
45+
46+
else:
47+
channel = "none"
48+
version = "${{ github.sha }}"
49+
50+
print("::set-output name=channel::" + channel)
51+
print("::set-output name=version::" + version)
52+
3553
- name: Install prerequisites (Debian)
3654
if: startsWith(matrix.os, 'ubuntu-')
3755
run: |
@@ -114,7 +132,7 @@ jobs:
114132
mv tup_build.sh tup_build.bat # in reality this is a .bat script on windows
115133
.\tup_build.bat
116134
117-
- name: Upload binary
135+
- name: Upload binary as artifact
118136
if: ${{ matrix.os == 'ubuntu-latest' && matrix.debug == false }}
119137
uses: actions/upload-artifact@v2
120138
with:
@@ -124,6 +142,46 @@ jobs:
124142
Firmware/build/ODriveFirmware.bin
125143
Firmware/build/ODriveFirmware.hex
126144
145+
- name: Copy firmware to temp folder
146+
run: |
147+
mkdir ${{ github.workspace }}/out
148+
cp ${{ github.workspace }}/Firmware/build/ODriveFirmware.elf ${{ github.workspace }}/out/firmware.elf
149+
150+
- name: Upload firmware to ODrive release system
151+
if: ${{ steps.release-info.outputs.channel == 'master' && matrix.os == 'ubuntu-latest' && matrix.debug == false && (startsWith(matrix.board_version, 'v3.5-') || startsWith(matrix.board_version, 'v3.6-')) }}
152+
uses: ./.github/actions/upload-release
153+
with:
154+
release_type: firmware
155+
version: ${{ steps.release-info.outputs.version }}
156+
src_dir: out
157+
do_access_key: ${{ secrets.DIGITALOCEAN_ACCESS_KEY }}
158+
do_secret_key: ${{ secrets.DIGITALOCEAN_SECRET_KEY }}
159+
odrive_api_key: ${{ secrets.ODRIVE_API_KEY }}
160+
product: ODrive ${{ matrix.board_version }}
161+
app: default
162+
variant: public
163+
164+
make-release:
165+
needs: [compile] # require all builds to succeed before we actually make the release
166+
if: needs.compile.outputs.channel == 'master'
167+
strategy:
168+
fail-fast: false
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Checkout git repository
172+
uses: actions/checkout@v2
173+
174+
- name: Install Python dependencies
175+
run: pip install aiohttp appdirs
176+
177+
- name: Add version to release channel
178+
uses: ./.github/actions/add-version-to-channel
179+
with:
180+
release_type: firmware
181+
channel: ${{ needs.compile.outputs.channel }}
182+
version: ${{ needs.compile.outputs.version }}
183+
odrive_api_key: ${{ secrets.ODRIVE_API_KEY }}
184+
127185
code-checks:
128186
strategy:
129187
fail-fast: false

0 commit comments

Comments
 (0)