Update c-cpp.yml #12
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 information | |
echo "Current directory:" | |
pwd | |
echo "Contents of the current directory:" | |
ls -la | |
# Change to the project root directory (if necessary) | |
# The following line might not be needed if the current directory is already the project root | |
cd /home/runner/work/dynamorio-missing-instructions/dynamorio-missing-instructions | |
# Confirm the change and list contents | |
echo "Changed to project root directory:" | |
pwd | |
ls -la | |
# Assuming the output directory is 'build' (modify as needed) | |
if [ -d "build" ]; then | |
echo "Building tar from 'build' directory" | |
tar -czvf myproject-${{ github.ref }}.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 |