Skip to content

Update c-cpp.yml

Update c-cpp.yml #12

Workflow file for this run

name: C Build, Test, and Release Example
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [ "published" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Build the project
run: |
make
if [ ! -f ./example ]; then
echo "Error: './example' binary not found after build!" >&2
exit 1
fi
- name: Get the release ID
id: release
run: |
RELEASE_ID=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} | jq -r '.id')
echo "Discovered RELEASE_ID: $RELEASE_ID"
echo "::set-output name=releaseId::$RELEASE_ID" # Correct the output name here
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'example'
releaseId: ${{ steps.release.outputs.releaseId }} # Use releaseId here