Update c-cpp.yml #10
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: | | |
# Display current directory | |
echo "Current directory:" | |
pwd | |
# List contents of the current directory | |
echo "Contents of the current directory:" | |
ls -la | |
# Change to the project root if not already there | |
cd ${{ github.workspace }}/dynamorio-missing-instructions | |
# Confirm the change and list contents | |
echo "Changed to project root directory:" | |
pwd | |
ls -la | |
# If the output folder is directly in the project root, adjust the path accordingly | |
# Assuming the output directory is 'build' (modify as needed) | |
if [ -d "build" ]; then | |
echo "Building tar from 'build' directory" | |
tar -czvf myproject-${{ github.sha }}.tar.gz build/ | |
else | |
echo "Build directory does not exist." | |
exit 1 | |
fi | |
- 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 |