Update README.md #2
This file contains hidden or 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: ubuntu-24.04 | |
| on: | |
| push: | |
| branches: [main, master, develop] # Trigger on pushes to main branches | |
| tags: | |
| - v*.*.* # Also trigger on version tags for releases | |
| pull_request: | |
| branches: [main, master] # Also trigger on PRs to main branches | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| # Step 1: Checkout the repository | |
| - uses: actions/checkout@v4 | |
| name: Checkout the repository | |
| # Step 2: Build the Docker image | |
| - name: Build the Docker image | |
| run: docker build . --file Dockerfile --tag my_software_engineering:latest | |
| # Step 2.5: Verify Docker image and cmake availability | |
| - name: Verify Docker image | |
| run: | | |
| docker run --rm my_software_engineering:latest which cmake | |
| docker run --rm my_software_engineering:latest which ninja | |
| docker run --rm my_software_engineering:latest cmake --version | |
| docker run --rm my_software_engineering:latest ninja --version | |
| # Step 3: Configure CMake | |
| - name: Configure CMake | |
| run: docker run --rm -v ${{ github.workspace }}:/software_engineering my_software_engineering:latest cmake --preset ninja-multi | |
| # Step 4: Build with CMake | |
| - name: Build with CMake | |
| run: docker run --rm -v ${{ github.workspace }}:/software_engineering my_software_engineering:latest cmake --build --preset ninja-multi-release | |
| # Step 5: Verify if build files are generated | |
| - name: List build directory contents | |
| run: docker run --rm -v ${{ github.workspace }}:/software_engineering my_software_engineering:latest ls -la /software_engineering/build | |
| # Step 6: Upload build artifacts as an artifact (if files exist) | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: software_engineering_build_output | |
| path: /software_engineering/build | |
| release: | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| if: startsWith(github.ref, 'refs/tags/') # Only run on tag pushes | |
| steps: | |
| # Step 1: Checkout the repository | |
| - uses: actions/checkout@v4 | |
| name: Checkout the repository | |
| # Step 2: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1) | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref_name }} # Use just the tag name (e.g., v1.0.0) | |
| release_name: Release ${{ github.ref_name }} # Name the release after the tag (e.g., v1.0.0) | |
| body: | | |
| Release notes for version ${{ github.ref_name }}. | |
| draft: false | |
| prerelease: false | |
| # Step 3: Upload build artifacts to release | |
| - name: Upload build artifacts to release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: /software_engineering/build/Release/main # Adjust to your actual file | |
| asset_name: master # Adjust this to name the artifact file | |
| asset_content_type: application/octet-stream | |