forked from gcormier/megadesk
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (81 loc) · 3.36 KB
/
firmware.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
name: "Firmware build"
on:
push:
paths:
- 'code/**'
tags:
- v*
workflow_dispatch:
jobs:
build:
env:
BaseFileName: ${{ github.event.repository.name }}
Timezone: America/Toronto
OutputFolder: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create build folder
run: |
mkdir $OutputFolder
- name: Install pyhon
uses: actions/setup-python@v3
- name: Install pio
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
# Get the current date and time, in the timezone specified above, for use later.
- name: Get current date and time
id: date
run: echo "::set-output name=date::$(TZ='${{ env.Timezone }}' date +'%Y-%m-%d %T')"
# Get the current date
- name: Get current date
id: date_only
run: echo "::set-output name=date_only::$(TZ='${{ env.Timezone }}' date +'%Y-%m-%d')"
- name: Build t841 noserial
run: pio run --project-dir ./code --environment attiny841_noserial
- name: Rename t841 noserial firmware
run: |
mv ./code/.pio/build/attiny841_noserial/firmware.hex $OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t841-noserial.hex
FILENAME1=$OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t841-noserial.hex
echo "FILENAME1=$FILENAME1" >> $GITHUB_ENV
- name: Build t841 serial
run: pio run --project-dir ./code --environment attiny841_serial
- name: Rename t841 serial firmware
run: |
mv ./code/.pio/build/attiny841_serial/firmware.hex $OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t841-serial.hex
FILENAME2=$OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t841-serial.hex
echo "FILENAME2=$FILENAME2" >> $GITHUB_ENV
- name: Build t1624 noserial
run: pio run --project-dir ./code --environment attiny1624_noserial
- name: Rename t1624 noserial firmware
run: |
mv ./code/.pio/build/attiny1624_noserial/firmware.hex $OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t1624-noserial.hex
FILENAME3=$OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t1624-noserial.hex
echo "FILENAME3=$FILENAME3" >> $GITHUB_ENV
- name: Build t1624 serial
run: pio run --project-dir ./code --environment attiny1624_serial
- name: Rename t1624 serial firmware
run: |
mv ./code/.pio/build/attiny1624_serial/firmware.hex $OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t1624-serial.hex
FILENAME4=$OutputFolder/$BaseFileName-$GITHUB_REF_NAME-t1624-serial.hex
echo "FILENAME4=$FILENAME4" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.BaseFileName}}-firmware-${{ steps.date_only.outputs.date_only }}
path: ${{ env.OutputFolder }}/**
- name: Display environment variables
run: |
echo "$GITHUB_CONTEXT"
echo "$GITHUB_ENV"
# Conditional release if it was tagged with v*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
${{ env.FILENAME1 }}
${{ env.FILENAME2 }}
${{ env.FILENAME3 }}
${{ env.FILENAME4 }}