From feed59a62e2622fc61941e225ca888ef31847a10 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 28 Sep 2024 11:18:27 +0800 Subject: [PATCH 1/2] Add auto release workflow ( dev ) --- .github/workflows/release-macos.yml | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/release-macos.yml diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml new file mode 100644 index 000000000..daebed96e --- /dev/null +++ b/.github/workflows/release-macos.yml @@ -0,0 +1,60 @@ +name: Release MacOS Artifacts + +on: + workflow_dispatch: + +jobs: + release: + runs-on: "macos-12" + timeout-minutes: 120 + + steps: + - name: Download latest artifacts + run: | + echo "Downloading latest artifacts..." + ARTIFACT_URL="https://api.github.com/repos/YaoApp/yao/actions/artifacts" + ARTIFACTS=$(curl -s -H "Accept: application/vnd.github.v3+json" $ARTIFACT_URL | jq -r '.artifacts[] | select(.name | contains("build-macos")) | .id') + for id in $ARTIFACTS; do + curl -L -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/YaoApp/yao/actions/artifacts/$id/zip" \ + -o artifact.zip + unzip artifact.zip -d ./artifacts + rm artifact.zip + done + ls -l ./artifacts + + # - name: Submit notarization request + # run: | + # echo "Submitting notarization request..." + # UUID=$(xcrun altool --notarize-app --primary-bundle-id "com.example.yourapp" \ + # --username "your-apple-id" --password "app-specific-password" \ + # --file ./artifacts/your-binary-file) + + # echo "Notarization UUID: $UUID" + # echo "$UUID" > notarization_uuid.txt + + # - name: Check notarization status + # id: check_notarization + # timeout-minutes: 120 + # run: | + # UUID=$(cat notarization_uuid.txt) + # STATUS="in progress" + # while [[ "$STATUS" == "in progress" ]]; do + # STATUS=$(xcrun altool --notarization-info "$UUID" \ + # --username "your-apple-id" --password "app-specific-password") + # echo "Notarization status: $STATUS" + # if [[ "$STATUS" == *"success"* ]]; then + # echo "::set-output name=status::success" + # break + # elif [[ "$STATUS" == *"invalid"* ]]; then + # echo "::set-output name=status::failed" + # break + # fi + # done + + # - name: Create Release + # if: steps.check_notarization.outputs.status == 'success' + # run: | + # echo "Creating a release..." + # VERSION=$(git rev-parse --short HEAD) + # gh release create "v1.0.0-$VERSION" ./artifacts/* --title "Release v0.10.4-$VERSION" --notes "Notarization succeeded. This is the release for version v1.0.0-$VERSION." From f0db90eb52f3ff87eb5123013e35da940249f9a6 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 28 Sep 2024 11:27:29 +0800 Subject: [PATCH 2/2] workflow debug --- .github/workflows/release-macos.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index daebed96e..9d8605807 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -13,13 +13,15 @@ jobs: run: | echo "Downloading latest artifacts..." ARTIFACT_URL="https://api.github.com/repos/YaoApp/yao/actions/artifacts" - ARTIFACTS=$(curl -s -H "Accept: application/vnd.github.v3+json" $ARTIFACT_URL | jq -r '.artifacts[] | select(.name | contains("build-macos")) | .id') + ARTIFACTS=$(curl -s -H "Accept: application/vnd.github.v3+json" $ARTIFACT_URL | jq -r '.artifacts[] | select(.name | contains("yao-macos")) | .id') for id in $ARTIFACTS; do - curl -L -H "Accept: application/vnd.github.v3+json" \ + echo "https://api.github.com/repos/YaoApp/yao/actions/artifacts/$id/zip" + curl -L -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/YaoApp/yao/actions/artifacts/$id/zip" \ -o artifact.zip - unzip artifact.zip -d ./artifacts - rm artifact.zip + unzip artifact.zip -d ./artifacts + rm artifact.zip + break done ls -l ./artifacts