diff --git a/.github/workflows/cmake-linux-deb.yml b/.github/workflows/cmake-linux-deb.yml index ac0bfb07..bbbe1f62 100644 --- a/.github/workflows/cmake-linux-deb.yml +++ b/.github/workflows/cmake-linux-deb.yml @@ -7,6 +7,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + release: + types: [ published ] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -18,6 +20,8 @@ jobs: # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-24.04 + permissions: + contents: write steps: - name: Load repository cache @@ -28,6 +32,10 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 + + - name: Set version + run: echo "VERSION=$(git describe --tags --always)" >> "$GITHUB_ENV" - name: Install CMake 4.0 run: | @@ -38,7 +46,7 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_WITH_UTILITY_APPLICATION=ON -DBUILD_WITH_BUNDLED_FREEGLUT=0 -DBUILD_WITH_BUNDLED_EIGEN=0 -DBUILD_WITH_BUNDLED_LIBLASZIP=0 -DBUILD_TESTING=ON + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_WITH_UTILITY_APPLICATION=ON -DBUILD_WITH_BUNDLED_FREEGLUT=0 -DBUILD_WITH_BUNDLED_EIGEN=0 -DBUILD_WITH_BUNDLED_LIBLASZIP=0 -DBUILD_TESTING=ON -DCPACK_PACKAGE_FILE_NAME=hd_mapping-${{env.VERSION}}-amd64 - name: Build # Build your program with the given configuration @@ -53,5 +61,11 @@ jobs: - name: Upload Debian package as artifact uses: actions/upload-artifact@v4 with: - name: hd_mapping-deb + name: hd_mapping-deb-${{env.VERSION}} path: ${{github.workspace}}/build/*.deb + + - name: Attach to GitHub release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: ${{github.workspace}}/build/*.deb diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1bf434c2..3b86f68d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -5,6 +5,8 @@ on: branches: ["main"] pull_request: branches: ["main"] + release: + types: [published] env: BUILD_TYPE: Release @@ -12,11 +14,17 @@ env: jobs: build: runs-on: macos-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 + + - name: Set version + run: echo "VERSION=$(git describe --tags --always)" >> "$GITHUB_ENV" - name: Install dependencies via Homebrew run: | @@ -60,11 +68,18 @@ jobs: chmod +x ${{github.workspace}}/macos_bundle_toolkit/create_dir_bundle_dmg.sh cd ${{github.workspace}} ./macos_bundle_toolkit/create_dir_bundle_dmg.sh + mv build/HDMapping.dmg "build/HDMapping-${VERSION}.dmg" - name: Upload DMG Artifact uses: actions/upload-artifact@v4 with: - name: hdmapping-macos-dmg - path: ${{github.workspace}}/build/HDMapping.dmg + name: hdmapping-macos-dmg-${{env.VERSION}} + path: ${{github.workspace}}/build/HDMapping-${{env.VERSION}}.dmg retention-days: 90 compression-level: 0 + + - name: Attach to GitHub release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: ${{github.workspace}}/build/HDMapping-${{env.VERSION}}.dmg diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bfd11112..c66d7469 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -7,6 +7,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + release: + types: [ published ] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -18,12 +20,19 @@ jobs: # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: windows-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 + + - name: Set version + shell: bash + run: echo "VERSION=$(git describe --tags --always)" >> "$GITHUB_ENV" - name: Install CMake 4.0 on Windows run: | @@ -51,9 +60,14 @@ jobs: shell: cmd run: deploy_mandeye.bat "${{github.workspace}}\deploy\mandeye" - - name: Upload mandeye ZIP as artifact + - name: Upload mandeye folder as artifact uses: actions/upload-artifact@v4 with: - name: mandeye-zip-windows - path: ${{github.workspace}}/deploy/*.zip + name: mandeye-windows-${{env.VERSION}} + path: ${{github.workspace}}/deploy/mandeye/ + - name: Attach to GitHub release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: ${{github.workspace}}/deploy/*.zip