-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from xyzroe/main
Rework workflow
- Loading branch information
Showing
6 changed files
with
90 additions
and
86 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Build, release, update | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build_firmware: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node JS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
~/.platformio/.cache | ||
key: ${{ runner.os }}-pio | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Install PlatformIO Core | ||
run: pip install --upgrade platformio | ||
|
||
- name: Build PlatformIO Project | ||
run: pio run | ||
- name: Get Release Version | ||
id: get_version | ||
shell: bash | ||
run: | | ||
value=`cat tools/version` | ||
echo "version=$value" >> $GITHUB_OUTPUT | ||
- name: Get current date | ||
id: date | ||
run: echo "date=$(date +'%d%m%y')" >> $GITHUB_OUTPUT | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true | ||
name: "v${{ steps.get_version.outputs.version }} (${{ steps.date.outputs.date }})" | ||
files: | | ||
bin/UZG-01.bin | ||
bin/UZG-01_v${{ steps.get_version.outputs.version }}.full.bin | ||
update_manifest: | ||
needs: build_firmware | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
- name: Get Release Version | ||
id: get_version | ||
shell: bash | ||
run: | | ||
value=`cat tools/version` | ||
echo "version=$value" >> $GITHUB_OUTPUT | ||
- name: Updare version in manifest.json | ||
run: | | ||
sed -r 's/v[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}/v${{ steps.get_version.outputs.version }}/g' manifest.json > new.manifest.json | ||
- name: Move file | ||
shell: bash | ||
run: | | ||
echo "old" | ||
cat manifest.json | ||
mv -f new.manifest.json manifest.json | ||
echo "new" | ||
cat manifest.json | ||
- name: Commit & Push changes | ||
uses: actions-js/push@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: 'update manifest.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
// AUTO GENERATED FILE, DO NOT EDIT | ||
#ifndef VERSION | ||
#define VERSION "0.1.3" | ||
#define VERSION "0.1.4" | ||
#endif | ||
#ifndef BUILD_TIMESTAMP | ||
#define BUILD_TIMESTAMP "2023-08-21 20:16:30.632450" | ||
#define BUILD_TIMESTAMP "2023-08-22 01:30:16.538290" | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.3 | ||
0.1.4 |