C/C++ CI and Release #5
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: C/C++ CI and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Trigger only on tags like v1.0.0 | |
workflow_dispatch: # Allow manual runs if needed | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: "Release ${{ github.ref_name }}" | |
draft: false | |
prerelease: false | |
build-and-release: | |
needs: create-release # Ensure the release is created before this job runs | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.os == 'macos-latest' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
extension: .out | |
- os: windows-latest | |
extension: .exe | |
- os: macos-latest | |
extension: .out | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Project | |
run: | | |
g++ -I./src ./XanaduCLI/XanaduCLI.cpp ./src/XanaduXVD.cpp ./src/XVDTypes.cpp -o XanaduCLI${{ matrix.extension }} | |
shell: bash # Ensures compatibility on all platforms | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: XanaduCLI${{ matrix.extension }} | |
asset_name: XanaduCLI-${{ matrix.os }}${{ matrix.extension }} | |
asset_content_type: application/octet-stream |