From 770a9f79a4716e34e136a3a48e7ba08917c83ce0 Mon Sep 17 00:00:00 2001 From: radj307 Date: Mon, 14 Feb 2022 19:47:26 -0500 Subject: [PATCH 1/2] Create GenerateRelease.yml --- .github/workflows/GenerateRelease.yml | 148 ++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 .github/workflows/GenerateRelease.yml diff --git a/.github/workflows/GenerateRelease.yml b/.github/workflows/GenerateRelease.yml new file mode 100644 index 0000000..13b3ad2 --- /dev/null +++ b/.github/workflows/GenerateRelease.yml @@ -0,0 +1,148 @@ +name: Generate Release + +on: + push: + tags: '*.*.*' + workflow_dispatch: + inputs: + name: + description: 'Release Name' + required: false + default: '' + type: string + tag: # Target tag to make a release for + description: 'Release Tag ()' + required: false + default: '' + type: string + is-draft: # Input that selects whether to make a draft release or a public release + description: 'Make Draft Release' + required: false + default: 'true' + type: boolean + is-prerelease: # Input that selects whether to make a pre-release or normal release + description: 'Make Pre-Release' + required: false + default: 'false' + type: boolean + autogenerate: + description: 'Autogenerate Release Notes From Commits' + required: false + default: 'false' + type: boolean + body: + description: 'Release Body Paragraph' + required: false + default: '' + +env: + BUILD_TYPE: Release + +jobs: + create-binaries: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ ubuntu-latest, windows-2022, macos-latest ] + fail-fast: true + + steps: + # Check out the repository + - uses: actions/checkout@v2 + with: + submodules: recursive + fetch-depth: 0 + + + # Set up platform dependencies + # Ninja + - uses: seanmiddleditch/gha-setup-ninja@master + # MSVC (Windows) + - if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + # gcc-10 g++-10 zip unzip (Linux) + - if: ${{ runner.os == 'Linux' }} + run: sudo apt-get update && sudo apt-get install gcc-10 g++-10 zip unzip -y + + + # Configure CMake Cache + # Windows + - name: Configure CMake (Windows) + if: ${{ runner.os == 'Windows' }} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja + # Linux/macOS + - name: Configure CMake (Linux/macOS) + if: ${{ runner.os != 'Windows' }} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja + env: + CC: gcc-10 + CXX: g++-10 + + # Build Binary + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + # Create Packaged Release Archive + # Windows + - name: Create Archive (Windows) + if: ${{ runner.os == 'Windows' }} + run: | + cd "${{github.workspace}}/build/ARRCON" + Compress-Archive ARRCON.exe ARRCON-$(.\ARRCON -vq)-Windows.zip + shell: powershell + # Linux / macOS + - name: Create Archive (Linux/macOS) + if: ${{ runner.os != 'Windows' }} + run: | + cd "${{github.workspace}}/build/ARRCON" + zip -T9 ARRCON-$(./ARRCON -vq)-${{runner.os}}.zip ARRCON + shell: bash + + # Upload Artifact + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: latest-${{runner.os}} + path: '${{github.workspace}}/build/ARRCON/*.zip' +#:create-binaries + + create-release: + needs: create-binaries + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + + steps: + # Download Artifacts + - name: 'Download Build Artifacts' + uses: actions/download-artifact@v2 + + # Retrieve the latest git tag if this was triggered by a tag + - name: 'Get Release Tag' + id: get_version + run: | + if [ "${{github.event.inputs.tag}}" == "" ]; then TAG="${GITHUB_REF/refs\/tags\//}"; else TAG="${{github.event.inputs.tag}}" ; fi + echo ::set-output name=VERSION::$TAG + echo ::set-output name=NAME::"Release $TAG" + + # Stage downloaded build artifacts for deployment + - name: 'Stage Archives' + run: | + cd ${{github.workspace}} + if mv ./latest-*/* ./ ; then ls -lAgh ; else ls -lAghR ; fi + shell: bash + + # Upload Release + - name: 'Create Release' + #if: ${{ github.event_name == 'workflow_dispatch' }} + uses: softprops/action-gh-release@v1 + with: + draft: ${{ github.event.inputs.is-draft || true }} + prerelease: ${{ github.event.inputs.is-prerelease || false }} + tag_name: ${{ steps.get_version.outputs.VERSION }} + name: ${{ steps.get_version.outputs.NAME }} + generate_release_notes: ${{ github.event.inputs.autogenerate || true }} + body: ${{ github.event.inputs.body || '' }} + fail_on_unmatched_files: true + files: ${{github.workspace}}/*.zip +#:create-release From ecbe591659f84e0167f833fe9a06db0d33c7369f Mon Sep 17 00:00:00 2001 From: radj307 Date: Mon, 14 Feb 2022 19:58:02 -0500 Subject: [PATCH 2/2] add automatic release generator workflow --- .github/workflows/GenerateRelease.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/GenerateRelease.yml b/.github/workflows/GenerateRelease.yml index 13b3ad2..b72ae80 100644 --- a/.github/workflows/GenerateRelease.yml +++ b/.github/workflows/GenerateRelease.yml @@ -36,6 +36,12 @@ on: default: '' env: + # [PROJECT_NAME] + # Currently this is used for the following scenarios: + # - Executable Name + # - Build Subdirectory Name + # - Archive Name Prefix + PROJECT_NAME: 'conv2' BUILD_TYPE: Release jobs: @@ -87,15 +93,15 @@ jobs: - name: Create Archive (Windows) if: ${{ runner.os == 'Windows' }} run: | - cd "${{github.workspace}}/build/ARRCON" - Compress-Archive ARRCON.exe ARRCON-$(.\ARRCON -vq)-Windows.zip + cd "${{github.workspace}}/build/${{env.PROJECT_NAME}}" + Compress-Archive "${{env.PROJECT_NAME}}.exe" "${{env.PROJECT_NAME}}-$(.\${{env.PROJECT_NAME}} -vq)-Windows.zip" shell: powershell # Linux / macOS - name: Create Archive (Linux/macOS) if: ${{ runner.os != 'Windows' }} run: | - cd "${{github.workspace}}/build/ARRCON" - zip -T9 ARRCON-$(./ARRCON -vq)-${{runner.os}}.zip ARRCON + cd "${{github.workspace}}/build/${{env.PROJECT_NAME}}" + zip -T9 "${{env.PROJECT_NAME}}-$(./${{env.PROJECT_NAME}} -vq)-${{runner.os}}.zip" "${{env.PROJECT_NAME}}" shell: bash # Upload Artifact @@ -103,7 +109,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: latest-${{runner.os}} - path: '${{github.workspace}}/build/ARRCON/*.zip' + path: '${{github.workspace}}/build/${{env.PROJECT_NAME}}/*.zip' #:create-binaries create-release: