From de6071baba916bc39c6d79cb4be58ede058bb217 Mon Sep 17 00:00:00 2001 From: Ronit Sinha Date: Sat, 22 Jul 2023 23:27:15 -0400 Subject: [PATCH] Create c-cpp.yml --- .github/workflows/c-cpp.yml | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..0a6257c --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,61 @@ +name: Build and Release + +on: + push: + branches: [ "main" ] + tags: + - 'v*' + pull_request: + branches: [ "main" ] + +jobs: + release: + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + tag: ${{ steps.tag.outputs.tag }} + steps: + - name: 'Generate Tag' + run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + if: startsWith(github.ref, 'refs/tags/v') + id: tag + - name: 'Create Release' + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.tag }} + release_name: Release ${{ steps.tag.outputs.tag }} + build-linux: + runs-on: ubuntu-latest + needs: release + steps: + - uses: actions/checkout@v3 + - name: make + run: make + - name: 'Upload Linux Binary' + id: upload-release-asset-linux + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: range_randomizer + asset_name: range_randomizer + build-windows: + runs-on: windows-latest + needs: release + steps: + - uses: actions/checkout@v3 + - name: make + run: make OUTPUT=range_randomizer.exe + - name: 'Upload Windows Binary' + id: upload-release-asset-windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: range_randomizer.exe + asset_name: range_randomizer.exe