diff --git a/.github/actions/get-workflow-artifact-ids/action.yml b/.github/actions/get-workflow-artifact-ids/action.yml new file mode 100644 index 0000000000000..56af5f67b2098 --- /dev/null +++ b/.github/actions/get-workflow-artifact-ids/action.yml @@ -0,0 +1,34 @@ +name: 'Get Workflow Artifact IDs' +description: 'Generates consistent artifact IDs and names based on workflow trigger' + +outputs: + filename: + description: 'Filename to use for artifacts (e.g. pr123)' + value: ${{ steps.generate-ids.outputs.filename }} + display-name: + description: 'Human readable name (e.g. PR123)' + value: ${{ steps.generate-ids.outputs.display_name }} + +runs: + using: "composite" + steps: + - id: generate-ids + shell: bash + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + ID="pr${{ github.event.pull_request.number }}" + DISPLAY_ID="PR${{ github.event.pull_request.number }}" + elif [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG=${GITHUB_REF#refs/tags/} + ID="$TAG" + DISPLAY_ID="$TAG" + else + SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) + BRANCH_NAME=${GITHUB_REF#refs/heads/} + ID="$BRANCH_NAME-$SHORT_SHA" + DISPLAY_ID="$BRANCH_NAME build $SHORT_SHA" + fi + + # Set outputs + echo "filename=$ID" >> $GITHUB_OUTPUT + echo "display_name=$DISPLAY_ID" >> $GITHUB_OUTPUT diff --git a/.github/workflows/build-macos-qt6.yml b/.github/workflows/build-macos-qt6.yml index ed9c1cefe2b5a..4e78595d6a2e8 100644 --- a/.github/workflows/build-macos-qt6.yml +++ b/.github/workflows/build-macos-qt6.yml @@ -3,7 +3,7 @@ name: 🍎 Build - MacOS Qt6 on: push: branches: - - main + - master - release-* pull_request: release: @@ -16,6 +16,9 @@ concurrency: jobs: build: + outputs: + artifact-x64-url: ${{ steps.artifact-x64-qt6.outputs.artifact-url }} + artifact-arm64-url: ${{ steps.artifact-arm64-qt6.outputs.artifact-url }} strategy: matrix: include: @@ -43,6 +46,10 @@ jobs: id: setup-vcpkg uses: ./.github/actions/setup-vcpkg + - name: 🎲 Get artifact ids + id: workflow-artifact-ids + uses: ./.github/actions/get-workflow-artifact-ids + - name: 🔨 Prepare build env run: | brew install automake bison flex gnu-sed create-dmg autoconf-archive nasm libtool fdupes @@ -81,11 +88,11 @@ jobs: cmake -S . \ -G Ninja \ -B build \ + -D QGIS_APP_NAME="QGIS-${{steps.workflow-artifact-ids.outputs.display-name}}" \ -D WITH_VCPKG=ON \ -D BUILD_WITH_QT6=ON \ -D WITH_QTWEBKIT=OFF \ -D WITH_BINDINGS=ON \ - -D QGIS_MACAPP_FRAMEWORK=OFF \ -D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \ -D VCPKG_HOST_TRIPLET="${{ matrix.triplet }}" \ -D VCPKG_INSTALL_OPTIONS="--only-binarycaching" \ @@ -115,7 +122,7 @@ jobs: if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' uses: actions/upload-artifact@v4 with: - name: kadas-albireo2-sdk-${{ matrix.triplet }} + name: qgis-sdk-${{ matrix.triplet }} path: | sdk/vcpkg-export-*.zip @@ -127,12 +134,37 @@ jobs: cmake --build build --target bundle - name: 📤 Upload dmg - # if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' uses: actions/upload-artifact@v4 + id: artifact-${{ matrix.triplet }}-qt6 with: - name: qgis-dmg-${{ matrix.triplet }} + name: qgis-dmg-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }} path: | - build/QGIS-Installer.dmg - # - name: Setup tmate session - # uses: mxschmitt/action-tmate@v3 - # if: always() + build/*.dmg + + - name: Upload release assets + uses: AButler/upload-release-assets@v3.0 + if: ${{ github.event_name == 'release' }} + with: + files: build/*.dmg + repo-token: ${{ secrets.GITHUB_TOKEN }} + + schedule_download_comment: + name: Comment pull request + runs-on: ubuntu-24.04 + needs: build + steps: + - name: 🐣 Checkout + uses: actions/checkout@v4 + + - name: Schedule download comment + uses: ./.github/actions/post_sticky_comment + if: github.event_name == 'pull_request' + with: + marker: macos-qt6 + body: | + ### 🍎 MacOS Qt6 builds + Download testable builds for this pull request + - Download [MacOS Qt6 arm64 (M series)](${{ needs.build.outputs.artifact-arm64-url }}) + - Download [MacOS Qt6 x64 (Intel)](${{ needs.build.outputs.artifact-arm64-url }}) + *(Built from commit ${{ github.event.pull_request.head.sha }})* + pr: ${{ github.event.number }}