Fixing release #9
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 with Release | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Setup dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake build-essential | |
- name: Build project | |
run: | | |
mkdir build && cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release | |
make | |
# Assuming 'make' or a custom command creates an 'output_folder' at the root of the project | |
# Here we add a step to list what's in the build directory | |
ls -la | |
- name: Archive the build outputs | |
run: | | |
# Ensure you are in the right directory | |
pwd | |
ls -la .. | |
# Replace 'output_folder' with the correct path to where your build outputs are stored | |
tar -czvf myproject-${{ github.sha }}.tar.gz ../output_folder/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/myproject-${{ github.sha }}.tar.gz | |
asset_name: myproject-${{ github.sha }}.tar.gz | |
asset_content_type: application/gzip |