-
Notifications
You must be signed in to change notification settings - Fork 74
158 lines (130 loc) · 5.42 KB
/
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
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
153
154
155
156
157
158
name: "FujiNet Tagged Version Release"
on:
push:
# branches:
# - release
tags:
- "v*"
jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
strategy:
matrix:
target-platform: [ATARI, ATARI-8mb, ADAM, APPLE, COCO, IEC-LOLIN-D32, MASTERIES-REVAB, MASTERIES-REVA-SPIFIX]
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.1'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install --upgrade platformio
pip install Jinja2
pip install pyyaml
- name: Show python version
run: python --version
- name: Show pio system info
run: pio system info
- name: Show pio location
run: pip show platformio
- name: Create PlatformIO INI for Build
run: cd /home/runner/work/fujinet-firmware/fujinet-firmware && /usr/bin/bash ./build.sh -l /home/runner/work/fujinet-firmware/fujinet-firmware/.github/workflows/platformio.release-${{ matrix.target-platform }}.ini -i /home/runner/work/fujinet-firmware/fujinet-firmware/platformio-generated.ini
- name: Show platformio.ini
run: cat /home/runner/work/fujinet-firmware/fujinet-firmware/platformio-generated.ini
- name: Get PIO build_board from INI
id: build_board
shell: bash
run: |
echo "NAME=$(grep '^[^;]*build_board ' /home/runner/work/fujinet-firmware/fujinet-firmware/platformio-generated.ini | sed s'/ //'g | cut -d "=" -f 2 | cut -d ";" -f 1)" >> $GITHUB_OUTPUT
- name: Build release
run: cd /home/runner/work/fujinet-firmware/fujinet-firmware && /usr/bin/bash ./build.sh -z -l /home/runner/work/fujinet-firmware/fujinet-firmware/.github/workflows/platformio.release-${{ matrix.target-platform }}.ini -i /home/runner/work/fujinet-firmware/fujinet-firmware/platformio-generated.ini
- name: Get version number from release.json
id: release-ver
shell: bash
run: |
echo "VERSION=$(cat firmware/release.json | grep '\"version\"' | cut -d '"' -f 4)" >> $GITHUB_OUTPUT
- name: Show Release Version
run: echo "Release version from JSON - ${{ steps.release-ver.outputs.VERSION }}"
shell: bash
- name: Rename firmware file if needed
shell: bash
run: |
mv firmware/fujinet-*.zip firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
- name: Fetch Tag Info
run: git fetch --tags --force
- name: Get Tag Info
uses: ericcornelissen/git-tag-annotation-action@v2
id: tag-data
- name: Show Tag Annotation
run: echo ${{ steps.tag-data.outputs.git-tag-annotation }}
# Grab tag message to use for platform release json description if available
- name: Create JSON Description from Tag Annotation if Available
if: ${{ steps.tag-data.outputs.git-tag-annotation != '' }}
run: echo "${{ steps.tag-data.outputs.git-tag-annotation }}" > firmware/annotation.txt
- name: Prepare platform release JSON
run: .github/workflows/preprelease.sh ${{ matrix.target-platform }} ${{ github.ref_name }} ${{ github.repository_owner }}
shell: bash
- name: Upload Release ZIP
uses: actions/upload-artifact@v4
with:
name: fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
path: firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
- name: Upload Releases JSON
uses: actions/upload-artifact@v4
with:
name: releases-${{ matrix.target-platform }}.json
path: firmware/releases-${{ matrix.target-platform }}.json
- name: Push Files to Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
files: |
firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
firmware/releases-${{ matrix.target-platform }}.json
- name: Get Git Short SHA
id: shortsha
run: |
echo "SHORTSHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# Notify fujinet.online to add the new firmware to FujiNet-flasher
- name: Notify FujiNet server
run: wget "https://fujinet.online/newfirmware.php?version=${{ github.ref_name }}&platform=${{ matrix.target-platform }}&githash=${{ steps.shortsha.outputs.SHORTSHA }}"
push-changelog:
name: "Push Change Log"
needs: tagged-release
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Save commits to change log
run: git log $(git describe --tags --abbrev=0 @^ 2> /dev/null)..@ --oneline > CHANGE.log
- name: Upload Change Log
uses: actions/upload-artifact@v4
with:
name: CHANGE.log
path: CHANGE.log
- name: Push Change log to Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
files: CHANGE.log