Update cmake-single-platform.yml #5
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: CMake Build and Release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
release: | |
types: [created] | |
env: | |
BUILD_TYPE: Release | |
ARTIFACT_NAME: phash-binaries | |
jobs: | |
build: | |
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 artifacts | |
cp build/pHash_demo artifacts/ || true | |
cp build/libpHash.a artifacts/ || true | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: release-artifacts/ | |
retention-days: 1 | |
create-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: release-artifacts | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
if: github.event_name == 'release' | |
with: | |
files: | | |
release-artifacts/* | |
tag_name: ${{ github.ref_name }} | |
name: "v${{ github.ref_name }}" | |
body: | | |
pHash ${{ github.ref_name }} binaries | |
Built on: ${{ github.event.release.published_at }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |