diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fca04964..6ea968dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,38 +1,27 @@ # # This script will tag the repo, compile and zip Einstein, and publish it -# as a GitHub Release +# as a GitHub Release. # -# see: https://github.com/marketplace/actions/publish-release -# -# Calling other workflows from this workflow: -# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows -name: 'Release Einstein on GitHub' +name: 'Deploy Einstein on GitHub' +# This job must be called explicitily form the 'Actions' tab in github on: workflow_dispatch: inputs: - version_tag: - description: 'Release Version Tag' - required: true - default: '2022.4.15' - #default: `grep -o 'VERSION "[^"]*' CMakeLists.txt | grep -o '[^"]*$'` - # use CMake to update the default release version tag - # have a checkbox to creat a new release or merge to an old release (or actually test if it exists) - # wouldn't it be nice to have a pulldown of existing releases... - # choose draft and prerelease - create-release-page: - type: boolean - description: Create Release Page - default: 'true' + # The Version Tag is extracted from CMakeLists.txt + #version_tag: + # description: 'Release Version Tag' + # required: true + # default: '2022.4.15' build-macos-universal-fltk: type: boolean description: Build macOS Universal FLTK default: 'true' - build-linux-i386-fltk: + build-linux-x64-fltk: type: boolean - description: Build Linux i386 FLTK + description: Build Linux x64 FLTK default: 'true' build-windows-x64-fltk: type: boolean @@ -48,33 +37,18 @@ on: jobs: - create-release-page: - runs-on: ubuntu-latest - if: ${{ github.event.inputs.create-release-page == 'true' }} - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.event.inputs.version_tag }} - release_name: "Version ${{ github.event.inputs.version_tag }}" - draft: false - prerelease: false - - name: Publish Release - uses: eregon/publish-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ steps.create_release.outputs.id }} - + # Build the MacOS FLTK version as a Universal Binary for i64 and ARM64 build-macos-universal-fltk: runs-on: macos-latest if: ${{ github.event.inputs.build-macos-universal-fltk == 'true' }} steps: - - name: Get sources + - name: Get Einstein Sources uses: actions/checkout@v2 + - name: Get Release Version Tag + run: | + export RELEASE_TAG="v"`grep -o '"Einstein" VERSION "[^"]*' CMakeLists.txt | grep -o '[^"]*$'` + echo "RELEASE_TAG=$RELEASE_TAG" + echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Get FLTK uses: actions/checkout@v2 with: @@ -114,25 +88,22 @@ jobs: - name: Pack Einstein run: | mv build/Einstein.app . - cmake -E tar cf Einstein.zip --format=zip Einstein.app - echo "https://github.com/" ${{ github.repository }} "/releases/tag/" ${{ github.event.inputs.version_tag }} - - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: 'https://github.com/${{ github.repository }}/releases/tag/${{ github.event.inputs.version_tag }}' - asset_path: ./Einstein.zip - asset_name: Einstein_macOS_universal_fltk_${{github.event.inputs.version_tag}}.zip - asset_content_type: application/zip - - uses: eregon/publish-release@v1 + cmake -E tar cf Einstein_macOS_universal_fltk_${{env.RELEASE_TAG}}.zip --format=zip Einstein.app + - name: Publish Einstein + uses: ncipollo/release-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ steps.create_release.outputs.id }} + allowUpdates: 'true' + artifacts: Einstein_macOS_universal_fltk_${{env.RELEASE_TAG}}.zip + artifactContentType: application/zip + bodyFile: ReleaseText.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} - build-linux-i386-fltk: + build-linux-x64-fltk: runs-on: ubuntu-latest - if: ${{ github.event.inputs.build-linux-i386-fltk == 'true' }} + if: ${{ github.event.inputs.build-linux-x64-fltk == 'true' }} steps: - name: Get dependencies run: | @@ -143,6 +114,11 @@ jobs: sudo apt-get install clang-format-13 - name: Get sources uses: actions/checkout@v2 + - name: Get Version + run: | + export RELEASE_TAG="v"`grep -o '"Einstein" VERSION "[^"]*' CMakeLists.txt | grep -o '[^"]*$'` + echo "RELEASE_TAG=$RELEASE_TAG" + echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Get FLTK uses: actions/checkout@v2 with: @@ -173,23 +149,21 @@ jobs: cmake -S . -B build \ -D CMAKE_BUILD_TYPE=Release cmake --build build --target Einstein - - name: Pack + - name: Pack Einstein run: | mv build/Einstein . - cmake -E tar cf Einstein.zip --format=zip Einstein - - name: Upload - uses: actions/upload-release-asset@v1.0.1 + cmake -E tar cf Einstein_linux_x64_fltk_${{env.RELEASE_TAG}}.zip --format=zip Einstein + - name: Publish Einstein + uses: ncipollo/release-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: 'https://github.com/${{ github.repository }}/releases/tag/${{ github.event.inputs.version_tag }}' - asset_path: ./Einstein.zip - asset_name: Einstein_linux_i386_fltk_${{github.event.inputs.version_tag}}.zip - asset_content_type: application/zip - tag_name: ${{ github.event.inputs.version_tag }} - release_name: "Version ${{ github.event.inputs.version_tag }}" - draft: false - prerelease: false + allowUpdates: 'true' + artifacts: Einstein_linux_x64_fltk_${{env.RELEASE_TAG}}.zip + artifactContentType: application/zip + bodyFile: ReleaseText.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} build-windows-x64-fltk: runs-on: windows-latest @@ -197,6 +171,16 @@ jobs: steps: - name: Get sources uses: actions/checkout@v2 + - name: Get Version + shell: pwsh + run: | + # Select-String -Path CMakeLists.txt -CaseSensitive -Pattern '"Einstein" VERSION' + $env:RELEASE_TAG2=(Select-String -Path CMakeLists.txt -CaseSensitive -Pattern '"Einstein" VERSION') + # gci env:RELEASE_TAG2 + $env:RELEASE_TAG=($env:RELEASE_TAG2 -replace '.* VERSION "', '' -replace '".*\)', '') + # gci env:RELEASE_TAG + echo "RELEASE_TAG=v$env:RELEASE_TAG" + echo "RELEASE_TAG=v$env:RELEASE_TAG" >> $env:GITHUB_ENV - name: Get FLTK uses: actions/checkout@v2 with: @@ -223,25 +207,29 @@ jobs: run: | mv build/Release/Einstein.exe . cmake -E tar cf Einstein.zip --format=zip Einstein.exe - - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: 'https://github.com/${{ github.repository }}/releases/tag/${{ github.event.inputs.version_tag }}' - asset_path: ./Einstein.zip - asset_name: Einstein_windows_x64_fltk_${{github.event.inputs.version_tag}}.zip - asset_content_type: application/zip - - uses: eregon/publish-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Pack Einstein + run: | + mv build/Release/Einstein.exe . + cmake -E tar cf Einstein_windows_x64_fltk_${{env.RELEASE_TAG}}.zip --format=zip Einstein.exe + - uses: ncipollo/release-action@v1 with: - release_id: ${{ steps.create_release.outputs.id }} + allowUpdates: 'true' + artifacts: Einstein_windows_x64_fltk_${{env.RELEASE_TAG}}.zip + artifactContentType: application/zip + bodyFile: ReleaseText.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} build-macos-universal-cocoa: runs-on: macos-latest if: ${{ github.event.inputs.build-macos-universal-cocoa == 'true' }} steps: - uses: actions/checkout@v2 + - name: Get Release Version Tag + run: | + export RELEASE_TAG="v"`grep -o '"Einstein" VERSION "[^"]*' CMakeLists.txt | grep -o '[^"]*$'` + echo "RELEASE_TAG=$RELEASE_TAG" + echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Build run: | xcodebuild archive \ @@ -252,20 +240,15 @@ jobs: - name: Pack Einstein run: | mv Einstein.xcarchive/Products/Applications/Einstein.app . - cmake -E tar cf Einstein.zip --format=zip Einstein.app - echo "https://github.com/"${{github.repository}}"/releases/tag/"${{github.event.inputs.version_tag}} - - uses: actions/upload-release-asset@v1.0.1 + cmake -E tar cf Einstein_macOS_universal_cocoa_${{env.RELEASE_TAG}}.zip --format=zip Einstein.app + - name: Publish Einstein + uses: ncipollo/release-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - # https://github.com/MatthiasWM/Einstein/releases/tag/2022.4.15.4 - upload_url: 'https://github.com/${{ github.repository }}/releases/tag/${{ github.event.inputs.version_tag }}' - asset_path: ./Einstein.zip - asset_name: Einstein_windows_x64_fltk_${{github.event.inputs.version_tag}}.zip - asset_content_type: application/zip - - uses: eregon/publish-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ steps.create_release.outputs.id }} - + allowUpdates: 'true' + artifacts: Einstein_macOS_universal_cocoa_${{env.RELEASE_TAG}}.zip + artifactContentType: application/zip + bodyFile: ReleaseText.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/ReleaseText.md b/ReleaseText.md new file mode 100644 index 00000000..1505d904 --- /dev/null +++ b/ReleaseText.md @@ -0,0 +1,3 @@ + +Testing automated deployment of binaries. +