ci: reuse build for release assets #75
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
# Workflow that attaches additional assets to github release. | ||
name: Attach Release Assets | ||
permissions: | ||
contents: write | ||
actions: write | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
attach-assets: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up the GitHub CLI | ||
uses: actions/gh-cli@v1 | ||
- name: Find Workflow Run ID for Build | ||
id: find_run_id | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
tag_name="${{ github.event.release.tag_name }}" | ||
workflow_id="test.yml" | ||
# Get workflow runs for the specified workflow ID and tag name | ||
response=$(gh api repos/${{ github.repository }}/actions/workflows/$workflow_id/runs \ | ||
-F event=push \ | ||
-F branch="$tag_name") | ||
# Extract the run ID of the latest workflow run on the specified tag | ||
run_id=$(echo "$response" | jq -r '.workflow_runs[] | select(.head_branch == env.tag_name) | .id' | head -n 1) | ||
if [ -z "$run_id" ]; then | ||
echo "No run ID found for tag: $tag_name in workflow: $workflow_id" | ||
exit 1 | ||
else | ||
echo "Found run ID: $run_id" | ||
echo "::set-output name=run_id::$run_id" | ||
fi | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: firmware-* | ||
merge-multiple: true | ||
run-id: ${{ steps.find_run_id.outputs.run_id }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Deploy release to github | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
fail_on_unmatched_files: true | ||
files: | | ||
hello.nrfcloud.com-*.* | ||
connectivity-bridge*.* | ||
nrf91-bl-*.hex | ||
nrf53-bl-*.hex | ||
- name: Trigger workflow that publishes firmware bundles to nRF Cloud | ||
working-directory: .github/workflows | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh workflow run publish-firmware-bundles.yml \ | ||
-F version=${{ github.event.release.tag_name }} | ||
- name: Trigger workflow that publishes symbol files to Memfault | ||
working-directory: .github/workflows | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh workflow run publish-symbol-files-to-memfault.yml \ | ||
-F version=${{ github.event.release.tag_name }} |