Skip to content

Update cmake-single-platform.yml #6

Update cmake-single-platform.yml

Update cmake-single-platform.yml #6

name: CMake Build and Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [created]
env:
BUILD_TYPE: Release
ARTIFACT_DIR: release-artifacts
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}}
- name: Collect Artifacts
run: |
mkdir -p ${{env.ARTIFACT_DIR}}
cp build/pHash_demo ${{env.ARTIFACT_DIR}}/ || true
cp build/libpHash.a ${{env.ARTIFACT_DIR}}/ || true
- name: Create Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: ${{env.ARTIFACT_DIR}}/*
tag_name: ${{ github.ref_name }}
name: "pHASH ${{ github.ref_name }}"
body: |
### pHash Build Artifacts
**Version:** ${{ github.ref_name }}
**Build Date:** ${{ steps.get-date.outputs.date }}
**Commit:** [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Build Artifacts
if: always() && github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: phash-build-${{ github.run_id }}
path: ${{env.ARTIFACT_DIR}}
retention-days: 1