From ccc5f8cf433af17fb732744a2cd59bd9f78443c1 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 10:55:54 +0330 Subject: [PATCH 01/18] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index d88016d..a3b337d 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -9,7 +9,7 @@ on: jobs: check_tag: runs-on: ubuntu-latest - + if: github.event_name != 'push' steps: - uses: actions/checkout@v2 - name: Check latest tag From bc248484746bfd0367288df78fc06cee3600f22c Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 11:06:25 +0330 Subject: [PATCH 02/18] Update blank.yml --- .github/workflows/blank.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index a3b337d..3370f72 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -14,6 +14,7 @@ jobs: - uses: actions/checkout@v2 - name: Check latest tag id: check_tag + if: github.event_name != 'push' run: | tag1=$(curl -s https://api.github.com/repos/MatsuriDayo/nekoray/tags | jq -r '.[0].name') tag2=$(curl -s https://api.github.com/repos/$GITHUB_REPOSITORY/tags | jq -r '.[0].name') @@ -76,6 +77,20 @@ jobs: echo "Latest tag is ${latest_tag}" echo "latest_tag=${latest_tag}" >> $GITHUB_ENV + - name: Check if release with same tag exists + id: check_release + uses: repo-sync/github-tag-action@v2.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.latest_tag }} + include_prereleases: true + + - name: Delete existing release + if: steps.check_release.outputs.release_id != '' + run: | + echo "Deleting release with tag ${latest_tag}..." + curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.check_release.outputs.release_id }} + - name: Create Release id: create_release uses: actions/create-release@v1 From 06783a89f29bdd6f5fe39b9a0f59ced28fa99a14 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 11:06:38 +0330 Subject: [PATCH 03/18] Update blank.yml --- .github/workflows/blank.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 3370f72..d9a15f6 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -9,7 +9,6 @@ on: jobs: check_tag: runs-on: ubuntu-latest - if: github.event_name != 'push' steps: - uses: actions/checkout@v2 - name: Check latest tag From dbbe5f4f4c6d5ab403d9e407784c22850f2618a1 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 11:12:59 +0330 Subject: [PATCH 04/18] Update nekoray_macos_builder.sh Trim all the extra path --- nekoray_macos_builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nekoray_macos_builder.sh b/nekoray_macos_builder.sh index f70908a..994ac9a 100644 --- a/nekoray_macos_builder.sh +++ b/nekoray_macos_builder.sh @@ -128,7 +128,7 @@ done #zip nekoray by arch for arch in "amd64" "arm64"; do - zip -r "$nPath/build/nekoray_$arch.zip" "$nPath/build/nekoray_$arch.app" + zip -jr "$nPath/build/nekoray_$arch.zip" "$nPath/build/nekoray_$arch.app" done echo "Build finished and output files are in $nPath/build" From 1767f51882585eb8cadc66766f84881073445a3b Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 11:45:22 +0330 Subject: [PATCH 05/18] Update blank.yml --- .github/workflows/blank.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index d9a15f6..66e7bbd 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -76,32 +76,20 @@ jobs: echo "Latest tag is ${latest_tag}" echo "latest_tag=${latest_tag}" >> $GITHUB_ENV - - name: Check if release with same tag exists - id: check_release - uses: repo-sync/github-tag-action@v2.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.latest_tag }} - include_prereleases: true - - - name: Delete existing release - if: steps.check_release.outputs.release_id != '' - run: | - echo "Deleting release with tag ${latest_tag}..." - curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.check_release.outputs.release_id }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 + - name: Create or Update Release + uses: marvinpinto/action-automatic-releases@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + owner: ${{ github.repository_owner }} + repo: ${{ github.repository }} tag_name: ${{ env.latest_tag }} release_name: ${{ env.latest_tag }} macOS - body: Built on the original repository. ${{ env.latest_tag }} - draft: false + body: | + Built on the original repository. ${{ env.latest_tag }} prerelease: ${{ contains(env.latest_tag, 'pre') }} - + delete_existing: false + - name: Upload Release Asset for amd64 id: upload_release_asset_amd64 uses: actions/upload-release-asset@v1 From ce37a0cc62bb13cd76264820274cebe548bba9f8 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 12:02:25 +0330 Subject: [PATCH 06/18] Update nekoray_macos_builder.sh --- nekoray_macos_builder.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nekoray_macos_builder.sh b/nekoray_macos_builder.sh index 994ac9a..cd9379a 100644 --- a/nekoray_macos_builder.sh +++ b/nekoray_macos_builder.sh @@ -128,7 +128,9 @@ done #zip nekoray by arch for arch in "amd64" "arm64"; do - zip -jr "$nPath/build/nekoray_$arch.zip" "$nPath/build/nekoray_$arch.app" + cd "$nPath/build" + zip -r "nekoray_$arch.zip" "nekoray_$arch.app" + cd - done echo "Build finished and output files are in $nPath/build" From 5e3f09659d2f48bf20819992c7d18715db564dc7 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 12:39:51 +0330 Subject: [PATCH 07/18] Update blank.yml --- .github/workflows/blank.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 66e7bbd..9c034a0 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -76,19 +76,30 @@ jobs: echo "Latest tag is ${latest_tag}" echo "latest_tag=${latest_tag}" >> $GITHUB_ENV - - name: Create or Update Release - uses: marvinpinto/action-automatic-releases@latest + - name: Check if release already exists + id: check_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + releases=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.latest_tag }}) + if [[ -n $releases ]]; then + echo "Release ${env.latest_tag} already exists, deleting..." + release_id=$(echo $releases | jq -r .[0].id) + curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id + curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.latest_tag }}" || true + fi + + - name: Create Release + id: create_release + uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - owner: ${{ github.repository_owner }} - repo: ${{ github.repository }} tag_name: ${{ env.latest_tag }} release_name: ${{ env.latest_tag }} macOS - body: | - Built on the original repository. ${{ env.latest_tag }} + body: Built on the original repository. ${{ env.latest_tag }} + draft: false prerelease: ${{ contains(env.latest_tag, 'pre') }} - delete_existing: false - name: Upload Release Asset for amd64 id: upload_release_asset_amd64 From db90c782f2cb4c7d302772f7cebc1e28e459ae0b Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 13:01:05 +0330 Subject: [PATCH 08/18] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 9c034a0..dbb461e 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -83,7 +83,7 @@ jobs: run: | releases=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.latest_tag }}) if [[ -n $releases ]]; then - echo "Release ${env.latest_tag} already exists, deleting..." + echo "Release ${{env.latest_tag}} already exists, deleting..." release_id=$(echo $releases | jq -r .[0].id) curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.latest_tag }}" || true From 850c028b7ef8c86b41dfc7859ef18094ce1f332a Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 13:04:45 +0330 Subject: [PATCH 09/18] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index dbb461e..bda4f71 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -82,7 +82,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | releases=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.latest_tag }}) - if [[ -n $releases ]]; then + if [[ -n $releases && $releases != *"Not Found"* ]]; then echo "Release ${{env.latest_tag}} already exists, deleting..." release_id=$(echo $releases | jq -r .[0].id) curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id From d040e1ed9e39d834485ddddec354efe41f0ec822 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 14:20:03 +0330 Subject: [PATCH 10/18] Update blank.yml --- .github/workflows/blank.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index bda4f71..4ff031f 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -84,7 +84,8 @@ jobs: releases=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.latest_tag }}) if [[ -n $releases && $releases != *"Not Found"* ]]; then echo "Release ${{env.latest_tag}} already exists, deleting..." - release_id=$(echo $releases | jq -r .[0].id) + release_id=$(echo $releases | jq -r .id) + release_id=$(echo $releases | jq -r '.[].id') curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.latest_tag }}" || true fi From 6ca9dc46ab5459f3614703824848ec4ecf14cc22 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 14:20:21 +0330 Subject: [PATCH 11/18] Update blank.yml --- .github/workflows/blank.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 4ff031f..69d2357 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -85,7 +85,6 @@ jobs: if [[ -n $releases && $releases != *"Not Found"* ]]; then echo "Release ${{env.latest_tag}} already exists, deleting..." release_id=$(echo $releases | jq -r .id) - release_id=$(echo $releases | jq -r '.[].id') curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.latest_tag }}" || true fi From 93eecc44bb69b42e7def793ba41890083c1da42d Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 15:21:47 +0330 Subject: [PATCH 12/18] Update blank.yml --- .github/workflows/blank.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 69d2357..bdd6efc 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,6 +87,7 @@ jobs: release_id=$(echo $releases | jq -r .id) curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$release_id curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.latest_tag }}" || true + sleep 10 fi - name: Create Release @@ -99,6 +100,7 @@ jobs: release_name: ${{ env.latest_tag }} macOS body: Built on the original repository. ${{ env.latest_tag }} draft: false + published: true prerelease: ${{ contains(env.latest_tag, 'pre') }} - name: Upload Release Asset for amd64 From ca08c39713288ba58c114b6a9ea593bc720b635b Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 16:02:56 +0330 Subject: [PATCH 13/18] Update blank.yml --- .github/workflows/blank.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index bdd6efc..5ffdf17 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -46,9 +46,41 @@ jobs: name: nekoray_arm64 path: nekoray/build/nekoray_arm64.zip + test: + strategy: + matrix: + os: [macos-10.15] + arch: [amd64] + + runs-on: ${{ matrix.os }} + needs: build + + steps: + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: nekoray_${{ matrix.arch }} + path: ./ + + - name: Unzip Artifact + run: | + unzip -q nekoray_${{ matrix.arch }}.zip + mv nekoray_${{ matrix.arch }}.app nekoray.app + + - name: Run Nekoray + run: | + ./nekoray.app/Contents/MacOS/nekoray > nekoray.log 2>&1 & + nekoray_pid=$! + sleep 10 + if ! ps -p "$nekoray_pid" > /dev/null; then + echo "Nekoray failed to stay open for 10 seconds." + cat nekoray.log + exit 1 + fi + create_release: runs-on: ubuntu-latest - needs: build + needs: test permissions: contents: write packages: write From 77d169c2a9fc1e38d404240d8805f39d8c7e352a Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 16:21:54 +0330 Subject: [PATCH 14/18] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 5ffdf17..f5ad7f8 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -49,7 +49,7 @@ jobs: test: strategy: matrix: - os: [macos-10.15] + os: [ubuntu-latest] arch: [amd64] runs-on: ${{ matrix.os }} From 9be9c37668ad35e14b3a8e02ac11a70ea6ef3d66 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 16:38:06 +0330 Subject: [PATCH 15/18] Update blank.yml --- .github/workflows/blank.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index f5ad7f8..f915e9b 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -49,8 +49,8 @@ jobs: test: strategy: matrix: - os: [ubuntu-latest] - arch: [amd64] + os: [macos-10.15, macos-11, macos-12] + arch: [amd64, arm64] runs-on: ${{ matrix.os }} needs: build From 929e0eaad86f0c1d1f6af54b58647b49a60b4995 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 20:46:55 +0330 Subject: [PATCH 16/18] Update nekoray_macos_builder.sh --- nekoray_macos_builder.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nekoray_macos_builder.sh b/nekoray_macos_builder.sh index cd9379a..665abc6 100644 --- a/nekoray_macos_builder.sh +++ b/nekoray_macos_builder.sh @@ -132,6 +132,18 @@ for arch in "amd64" "arm64"; do zip -r "nekoray_$arch.zip" "nekoray_$arch.app" cd - done +if [ -z "$GITHUB_ACTIONS" ]; then + for arch in "amd64" "arm64"; do + TEMP_PATH=$(pwd) + cd "$nPath/build" + zip -r "nekoray_$arch.zip" "nekoray_$arch.app" + cd "$TEMP_PATH" + done +else + for arch in "amd64" "arm64"; do + zip -r "$nPath/build/nekoray_$arch.zip" "$nPath/build/nekoray_$arch.app" + done +fi echo "Build finished and output files are in $nPath/build" cd "$nPath" From 5d7f20c834ef8df33976f5d29c902e9134ad3b23 Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 20:48:47 +0330 Subject: [PATCH 17/18] Update nekoray_macos_builder.sh --- nekoray_macos_builder.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nekoray_macos_builder.sh b/nekoray_macos_builder.sh index 665abc6..aae6283 100644 --- a/nekoray_macos_builder.sh +++ b/nekoray_macos_builder.sh @@ -127,11 +127,6 @@ for cmd in "nekobox_core" "nekoray_core"; do done #zip nekoray by arch -for arch in "amd64" "arm64"; do - cd "$nPath/build" - zip -r "nekoray_$arch.zip" "nekoray_$arch.app" - cd - -done if [ -z "$GITHUB_ACTIONS" ]; then for arch in "amd64" "arm64"; do TEMP_PATH=$(pwd) From 3199d458470e1344c78cebddcaa4b1dbbcb3147e Mon Sep 17 00:00:00 2001 From: Steve Moretz Date: Tue, 18 Apr 2023 21:08:19 +0330 Subject: [PATCH 18/18] Update nekoray_macos_builder.sh --- nekoray_macos_builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nekoray_macos_builder.sh b/nekoray_macos_builder.sh index aae6283..5f4dd5f 100644 --- a/nekoray_macos_builder.sh +++ b/nekoray_macos_builder.sh @@ -127,7 +127,7 @@ for cmd in "nekobox_core" "nekoray_core"; do done #zip nekoray by arch -if [ -z "$GITHUB_ACTIONS" ]; then +if [ -n "$GITHUB_ACTIONS" ]; then for arch in "amd64" "arm64"; do TEMP_PATH=$(pwd) cd "$nPath/build"