This commit is contained in:
@@ -39,45 +39,34 @@ jobs:
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Get version
|
||||
id: package_version
|
||||
uses: KageKirin/get-csproj-version@v0
|
||||
with:
|
||||
file: MareSynchronos/MareSynchronos.csproj
|
||||
regex: '^(?<super>0|[1-9]\d*)\.(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)(\.(?<patch>0|[1-9]\d*))'
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Version: ${{ steps.package_version.outputs.version }}"
|
||||
|
||||
- name: Prepare Club Penguin
|
||||
run: |
|
||||
mkdir -p output
|
||||
cp MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip output/ClubPenguinSync-${{ steps.package_version.outputs.version }}.zip
|
||||
mv MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip /repo/download/ClubPenguinSync-${{ steps.package_version.outputs.version }}.zip
|
||||
cp MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip output/ClubPenguinSync-${{ gitea.ref_name }}.zip
|
||||
mv MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip /repo/download/ClubPenguinSync-${{ gitea.ref_name }}.zip
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
run: |
|
||||
echo "=== Searching for existing release ${{ steps.package_version.outputs.version }}==="
|
||||
echo "=== Searching for existing release ${{ gitea.ref_name }}==="
|
||||
|
||||
release_id=$(curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/v${{ steps.package_version.outputs.version }}" | jq -r .id)
|
||||
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${{ gitea.ref_name }}" | jq -r .id)
|
||||
|
||||
if [ "$release_id" != "null" ]; then
|
||||
echo "=== Deleting existing release ${{ steps.package_version.outputs.version }}==="
|
||||
echo "=== Deleting existing release ${{ gitea.ref_name }}==="
|
||||
curl -X DELETE -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/$release_id"
|
||||
fi
|
||||
|
||||
echo "=== Creating new release ${{ steps.package_version.outputs.version }}==="
|
||||
echo "=== Creating new release ${{ gitea.ref_name }}==="
|
||||
response=$(
|
||||
curl --fail-with-body -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-d '{
|
||||
"tag_name": "v${{ steps.package_version.outputs.version }}",
|
||||
"name": "v${{ steps.package_version.outputs.version }}",
|
||||
"tag_name": "${{ gitea.ref_name }}",
|
||||
"name": "${{ gitea.ref_name }}",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
@@ -91,19 +80,19 @@ jobs:
|
||||
run: |
|
||||
curl --fail-with-body -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-F "attachment=@output/ClubPenguinSync-${{ steps.package_version.outputs.version }}.zip" \
|
||||
-F "attachment=@output/ClubPenguinSync-${{ gitea.ref_name }}}.zip" \
|
||||
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/${{ steps.create_release.outputs.release_id }}/assets"
|
||||
|
||||
- name: Update repo.json with version
|
||||
env:
|
||||
VERSION: ${{ steps.package_version.outputs.version }}
|
||||
VERSION: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
pluginJsonPath="${PLUGIN_NAME}/bin/x64/Release/${PLUGIN_NAME}.json"
|
||||
repoJsonPath="/repo/repo.json"
|
||||
version="${VERSION}"
|
||||
downloadUrl="https://clubpenguin.drgn.rocks/download/ClubPenguinSync-${{ steps.package_version.outputs.version }}.zip"
|
||||
downloadUrl="https://clubpenguin.drgn.rocks/download/ClubPenguinSync-${{ gitea.ref_name }}.zip"
|
||||
|
||||
# Read plugin JSON
|
||||
pluginJson=$(cat "$pluginJsonPath")
|
||||
|
||||
Reference in New Issue
Block a user