Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MG-5 committed Nov 25, 2022
1 parent 380d75b commit 349500e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- 'main'
workflow_call: # to reuse this workflow by release.yml

jobs:
build:
Expand Down Expand Up @@ -34,4 +35,18 @@ jobs:
- name: Build binary
run: |
cmake -B build/${{ matrix.type }} -G Ninja -DCMAKE_C_COMPILER:FILEPATH=arm-none-eabi-gcc -DCMAKE_CXX_COMPILER:FILEPATH=arm-none-eabi-g++ -DCMAKE_BUILD_TYPE="${{ matrix.type }}"
cmake --build build/${{ matrix.type }}
cmake --build build/${{ matrix.type }}
- name: Rename and move build files
run : |
mkdir build/artifacts
mv build/${{ matrix.type }}/*.bin build/artifacts/firmware_${{ matrix.type }}.bin
mv build/${{ matrix.type }}/*.elf build/artifacts/firmware_${{ matrix.type }}.elf
- name: Upload build files
uses: actions/[email protected]
with:
name: build-artifact
path: ./build/artifacts/
retention-days: 1
if-no-files-found: error
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Create Release

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build-project:
uses: Netz39/Stepper-Locking-System_firmware/.github/workflows/build.yml@add-release-workflow

create-release:
runs-on: ubuntu-latest
needs: build-project
steps:
- name: "Generate release changelog"
id: generate-release-changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
onlyLastTag: "false" # set to false if no tags exist (buggy with only one tag)
stripHeaders: "true"
stripGeneratorNotice: "true"

- name: Extract the VERSION name
id: get-version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Retrieve build files
uses: actions/[email protected]
with:
name: build-artifact
path: build/artifacts

- name: "Create GitHub release"
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: "${{ steps.get-version.outputs.VERSION }}"
body: "${{ steps.generate-release-changelog.outputs.changelog }}"
prerelease: ${{ startsWith(steps.get-version.outputs.VERSION, 'v0.') }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
./build/artifacts/*

0 comments on commit 349500e

Please sign in to comment.