Skip to content

Update c-cpp.yml

Update c-cpp.yml #17

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: get_release
run: |
echo "RELEASE_ID=${{ github.event.release.id }}" >> $GITHUB_ENV
echo "Release ID: ${{ github.event.release.id }}"
- name: Upload the artifacts
uses: actions/upload-release-asset@v1
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}/assets?name=example
asset_path: ./example
asset_name: example
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}