ci: Combine build workflows into one, and make tag workflow reuse bui… #7
Workflow file for this run
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
on: | ||
push: | ||
branches: | ||
- feature/captive-portal-ci | ||
tags: | ||
- 'v**' | ||
name: ci-tag | ||
env: | ||
SHOCKLINK_API_DOMAIN: api.shocklink.net | ||
SHOCKLINK_FW_VERSION: ${{ github.ref_name }} | ||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Build project | ||
uses: ./.github/workflows/ci-build.yml | ||
- name: Download release notes | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
RELEASE.md | ||
- name: Download internal artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: merged-firmware.bin | ||
# This step reads a file from repo and use it for body of the release | ||
# This works on any self-hosted runner OS | ||
- name: Read RELEASE.md | ||
id: read_release | ||
shell: bash | ||
run: | | ||
r=$(cat RELEASE.md) # <--- Read release.md (Provide correct path as per your repo) | ||
r="${r//'%'/'%25'}" # Multiline escape sequences for % | ||
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n' | ||
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r' | ||
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # <--- Set environment variable | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: merged-firmware.bin | ||
asset_name: ShockLink.bin | ||
tag: ${{ github.ref }} | ||
body: | | ||
${{ steps.read_release.outputs.RELEASE_BODY }} |