diff --git a/.github/workflows/build-hatch.yml b/.github/workflows/build-hatch.yml index 731dff469..7dddac94d 100644 --- a/.github/workflows/build-hatch.yml +++ b/.github/workflows/build-hatch.yml @@ -151,37 +151,29 @@ jobs: mv "$wheel" "../$PYAPP_REPO" echo "PYAPP_PROJECT_PATH=$wheel" >> $GITHUB_ENV + - name: Build binary + run: hatch build --target app + + # Windows installers don't accept non-integer versions so we ubiquitously + # perform the following transformation: X.Y.Z.devN -> X.Y.Z.N - name: Set project version id: version run: |- - raw_version="$(hatch version)" - version="${raw_version/dev/}" + old_version="$(hatch version)" + version="${old_version/dev/}" + + if [[ "$version" != "$old_version" ]]; then + cd dist/app + old_binary="$(ls)" + binary="${old_binary/$old_version/$version}" + mv "$old_binary" "$binary" + fi - echo "raw-version=$raw_version" >> $GITHUB_OUTPUT echo "version=$version" >> $GITHUB_OUTPUT echo "$version" - # We cannot use anchors because of https://github.com/actions/runner/issues/1182 and - # other solutions like writing a composite action are burdensome - - name: Set reusable script - Correct binary version - id: script-version - # Windows installers don't accept non-integer versions so we ubiquitously - # perform the following transformation: X.Y.Z.devN -> X.Y.Z.N - run: |- - cat <<"OUTER" >> $GITHUB_OUTPUT - script<> $GITHUB_OUTPUT - script<> $GITHUB_OUTPUT - script<--.exe -> targets//.exe + # bin/--.exe -> targets//.exe + - name: Prepare binaries run: |- - cat <<"OUTER" >> $GITHUB_OUTPUT - script<- @@ -344,6 +259,13 @@ jobs: mkdir installers mv build/*/release/*/*.{exe,msi} installers + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: standalone + path: archives/* + if-no-files-found: error + - name: Upload installers uses: actions/upload-artifact@v3 with: @@ -371,36 +293,27 @@ jobs: - name: Install PyOxidizer ${{ env.PYOXIDIZER_VERSION }} run: pip install pyoxidizer==${{ env.PYOXIDIZER_VERSION }} - # TODO: Use the next official release after 0.22.0 by removing these 2 blocks, uncommenting - # the following one, and changing the artifact name to reflect the next version. See: - # https://github.com/indygreg/apple-platform-rs/issues/82 - # - # We use the artifact from the latest scheduled nightly job because installing - # with Cargo from scratch takes ~10 minutes - name: Install rcodesign - uses: dawidd6/action-download-artifact@v2 + env: + ARCHIVE_NAME: "apple-codesign-0.26.0-x86_64-apple-darwin" + run: >- + curl -L + "https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.26.0/$ARCHIVE_NAME.tar.gz" + | + tar --strip-components=1 -xzf - -C /usr/local/bin "$ARCHIVE_NAME/rcodesign" + + - name: Download staged binaries + uses: actions/download-artifact@v3 with: - repo: indygreg/apple-platform-rs - workflow: rcodesign.yml - event: schedule - workflow_conclusion: success - name: exe-rcodesign-x86_64-apple-darwin - path: /usr/local/bin - search_artifacts: true - check_artifacts: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Finalize rcodesign - run: chmod +x /usr/local/bin/rcodesign - - # - name: Install rcodesign - # env: - # ARCHIVE_NAME: "apple-codesign-0.22.0-x86_64-apple-darwin" - # run: >- - # curl -L - # "https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/$ARCHIVE_NAME.tar.gz" - # | - # tar --strip-components=1 -xzf - -C /usr/local/bin "$ARCHIVE_NAME/rcodesign" + name: staged-${{ runner.os }} + path: archives + + - name: Extract staged binaries + run: |- + mkdir bin + for f in archives/*; do + tar -xzf "$f" -C bin + done - name: Write credentials env: @@ -416,26 +329,9 @@ jobs: echo "$APPLE_DEVELOPER_ID_INSTALLER_PRIVATE_KEY" > /tmp/private-key-installer.pem echo "$APPLE_APP_STORE_CONNECT_API_DATA" > /tmp/app-store-connect.json - # We cannot use anchors because of https://github.com/actions/runner/issues/1182 and - # other solutions like writing a composite action are burdensome - - name: Set reusable script - Extract binaries - id: script-extract - run: |- - cat <<"OUTER" >> $GITHUB_OUTPUT - script<> $GITHUB_OUTPUT - script<> $GITHUB_OUTPUT - script<-- -> targets// - - name: Prepare managed binaries + - name: Prepare binaries run: |- mkdir targets for f in bin/*; do @@ -571,6 +420,13 @@ jobs: --staple "signed/${{ steps.pkg.outputs.path }}" + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: standalone + path: archives/* + if-no-files-found: error + - name: Upload installer uses: actions/upload-artifact@v3 with: