Release #50
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: Release | |
on: workflow_dispatch | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_next_version.outputs.version }} | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get next version | |
id: get_next_version | |
uses: thenativeweb/get-next-version@main | |
- name: Check if has next version | |
run: | | |
if [[ '${{steps.get_next_version.outputs.hasNextVersion}}' == 'false' ]]; then | |
echo "Failed to comput next version!" | |
exit 1 | |
fi | |
create-release: | |
needs: get-version | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.set_output.outputs.version }} | |
steps: | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.get-version.outputs.version }} | |
- name: Set version output for dependent jobs | |
id: set_output | |
run: echo "version=${{ needs.get-version.outputs.version }}" >> "$GITHUB_OUTPUT" | |
build-and-upload-linux: | |
needs: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo apt-get update && sudo apt-get install libboost-program-options-dev libssl-dev libgit2-dev | |
- name: Build | |
run: | | |
mkdir build && cd build | |
cmake -DBOOST_USE_STATIC_LIBS=On -DCAPS_LOG_VERSION="${{ needs.create-release.outputs.version }}" -DCMAKE_BUILD_TYPE=Release .. && make | |
- name: Archive and Upload binaries to release | |
run: | | |
cp build/source/caps-log ./caps-log | |
tar -czvf caps-log-linux.tar.gz caps-log | |
gh release upload ${{ needs.create-release.outputs.version }} caps-log-linux.tar.gz --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-and-upload-mac: | |
needs: create-release | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: brew install boost openssl libgit2 | |
- name: Build for MacOS | |
run: | | |
mkdir build-macos && cd build-macos | |
cmake -DBOOST_USE_STATIC_LIBS=On -DCAPS_LOG_VERSION="${{ needs.create-release.outputs.version }}" -DCMAKE_BUILD_TYPE=Release .. && make | |
- name: Archive and Upload MacOS binaries to release | |
run: | | |
cp build-macos/source/caps-log ./caps-log | |
tar -czvf caps-log-macos.tar.gz caps-log | |
gh release upload ${{ needs.create-release.outputs.version }} caps-log-macos.tar.gz --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |