This commit is contained in:
@@ -39,45 +39,34 @@ jobs:
|
|||||||
dotnet restore
|
dotnet restore
|
||||||
dotnet build --configuration Release --no-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
|
- name: Prepare Club Penguin
|
||||||
run: |
|
run: |
|
||||||
mkdir -p output
|
mkdir -p output
|
||||||
cp MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip output/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-${{ steps.package_version.outputs.version }}.zip
|
mv MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip /repo/download/ClubPenguinSync-${{ gitea.ref_name }}.zip
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
run: |
|
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 }}" \
|
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
|
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 }}" \
|
curl -X DELETE -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/$release_id"
|
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/$release_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Creating new release ${{ steps.package_version.outputs.version }}==="
|
echo "=== Creating new release ${{ gitea.ref_name }}==="
|
||||||
response=$(
|
response=$(
|
||||||
curl --fail-with-body -X POST \
|
curl --fail-with-body -X POST \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
-d '{
|
-d '{
|
||||||
"tag_name": "v${{ steps.package_version.outputs.version }}",
|
"tag_name": "${{ gitea.ref_name }}",
|
||||||
"name": "v${{ steps.package_version.outputs.version }}",
|
"name": "${{ gitea.ref_name }}",
|
||||||
"draft": false,
|
"draft": false,
|
||||||
"prerelease": false
|
"prerelease": false
|
||||||
}' \
|
}' \
|
||||||
@@ -91,19 +80,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
curl --fail-with-body -s -X POST \
|
curl --fail-with-body -s -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
-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"
|
"https://git.drgn.rocks/api/v1/repos/${GITHUB_REPOSITORY}/releases/${{ steps.create_release.outputs.release_id }}/assets"
|
||||||
|
|
||||||
- name: Update repo.json with version
|
- name: Update repo.json with version
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.package_version.outputs.version }}
|
VERSION: ${{ gitea.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
pluginJsonPath="${PLUGIN_NAME}/bin/x64/Release/${PLUGIN_NAME}.json"
|
pluginJsonPath="${PLUGIN_NAME}/bin/x64/Release/${PLUGIN_NAME}.json"
|
||||||
repoJsonPath="/repo/repo.json"
|
repoJsonPath="/repo/repo.json"
|
||||||
version="${VERSION}"
|
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
|
# Read plugin JSON
|
||||||
pluginJson=$(cat "$pluginJsonPath")
|
pluginJson=$(cat "$pluginJsonPath")
|
||||||
|
|||||||
Reference in New Issue
Block a user