Updated workflows, again. #1
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build and release application | |
steps: | |
- name: Cache toolchain | |
uses: actions/cache@v3 | |
id: toolchain-cache | |
with: | |
path: ./firmware | |
key: firmware | |
- name: Checkout firmware | |
if: steps.toolchain-cache.outputs.cache-hit != 'true' | |
run: git clone https://github.com/flipperdevices/flipperzero-firmware.git --recursive --depth 1 firmware | |
- name: Install toolchain | |
if: steps.toolchain-cache.outputs.cache-hit != 'true' | |
run: cd firmware && ./fbt | |
- name: Checkout application | |
uses: actions/checkout@v3 | |
with: | |
path: firmware/applications_user/clippy | |
- name: Set Env | |
run: | | |
cd firmware/applications_user/clippy | |
export VERSION=$(cat version.h | sed 's/[^0-9,.]//g') | |
export TAG=v${VERSION} | |
export RELEASE_TEXT=$(grep -Pzo "## ${VERSION}\n(\n|.)+?\n##" CHANGELOG.md | sed '$ d') | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "TAG=${TAG}" >> $GITHUB_ENV | |
# add multiline release text | |
echo "RELEASE_TEXT<<EOF" >> $GITHUB_ENV | |
echo "${RELEASE_TEXT}" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Printenv | |
run: | | |
echo "VERSION=${VERSION}" | |
echo "TAG=${TAG}" | |
echo "RELEASE_TEXT=${RELEASE_TEXT}" | |
printenv | |
- name: Build application | |
run: cd firmware && ./fbt fap_clippy | |
- name: Create Draft Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG }} | |
release_name: Release v${{ env.VERSION }} | |
body: ${{ env.RELEASE_TEXT }} | |
draft: true | |
prerelease: false | |
- uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./firmware/build/f7-firmware-D/.extapps/clippy.fap | |
asset_name: clippy.fap | |
asset_content_type: application/x-object | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |