Skip to content

Update readme.md

Update readme.md #57

Workflow file for this run

name: Build and Release Nekoray
on:
push:
branches: [main]
jobs:
check_tag:
runs-on: ubuntu-latest
steps:
- 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')
echo "Latest tag on MatsuriDayo/nekoray: $tag1"
echo "Latest tag on this repository: $tag2"
if [[ "$tag1" == "$tag2" ]]; then
echo "Latest tags match! Aborting workflow."
exit 1
fi
build:
runs-on: macos-13
needs: check_tag
steps:
- uses: actions/checkout@v2
- name: Build Nekoray
run: |
bash builder.sh
- name: Upload Artifact for amd64
uses: actions/upload-artifact@v2
with:
name: nekoray_amd64
path: nekoray/build/nekoray_amd64.zip
- name: Upload Artifact for arm64
uses: actions/upload-artifact@v2
with:
name: nekoray_arm64
path: nekoray/build/nekoray_arm64.zip
test:
strategy:
matrix:
os: [macos-11, macos-12, macos-13]
arch: [amd64, arm64]
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: test
permissions:
contents: write
packages: write
actions: read
pull-requests: write
issues: write
steps:
- name: Download Artifact for amd64
uses: actions/download-artifact@v2
with:
name: nekoray_amd64
path: ./
- name: Download Artifact for arm64
uses: actions/download-artifact@v2
with:
name: nekoray_arm64
path: ./
- name: Check latest tag
id: check_tag
run: |
latest_tag=$(git ls-remote --tags --sort=-v:refname https://github.com/MatsuriDayo/nekoray.git | head -n1 | awk '{print $2}' | sed 's/refs\/tags\///')
echo "Latest tag is ${latest_tag}"
echo "latest_tag=${latest_tag}" >> $GITHUB_ENV
- 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 && $releases != *"Not Found"* ]]; then
echo "Release ${{env.latest_tag}} already exists, deleting..."
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
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.latest_tag }}
release_name: ${{ env.latest_tag }} macOS (Intel + Apple)
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
id: upload_release_asset_amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: nekoray_amd64.zip
asset_name: nekoray_amd64.zip
asset_content_type: application/zip
- name: Upload Release Asset for arm64
id: upload_release_asset_arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: nekoray_arm64.zip
asset_name: nekoray_arm64.zip
asset_content_type: application/zip