更新 maven-publish.yml

This commit is contained in:
Yang Yang
2024-02-23 10:32:17 +08:00
committed by GitHub
parent 6469d6bab4
commit 357fcd87e3

View File

@@ -28,7 +28,6 @@ jobs:
fi
shell: bash
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
@@ -55,7 +54,22 @@ jobs:
- name: Build native image with Maven
run: ./mvnw native:compile -Pnative
- name: Create Release
- name: Check if release exists
id: check_release
run: |
RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.tag_name.outputs.tag }}) || true
if echo "$RELEASE" | grep -q '"id":'; then
echo "::set-output name=exists::true"
UPLOAD_URL=$(echo "$RELEASE" | jq -r .upload_url)
echo "::set-output name=upload_url::${UPLOAD_URL}"
else
echo "::set-output name=exists::false"
fi
shell: bash
- name: Create Release if not exists
if: steps.check_release.outputs.exists == 'false'
id: create_release
uses: actions/create-release@v1
env:
@@ -71,7 +85,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /target/gpt-4-copilot # Make sure this is the correct path to your built artifact
asset_name: gpt-4-copilot-${{ steps.tag_name.outputs.tag }}-${{ matrix.os }} # Make sure this is the correct name of your built artifact
upload_url: ${{ steps.check_release.outputs.exists == 'true' && steps.check_release.outputs.upload_url || steps.create_release.outputs.upload_url }}
asset_path: ./target/gpt-4-copilot # 更新为您的构建产物路径
asset_name: gpt-4-copilot-${{ steps.tag_name.outputs.tag }}-${{ matrix.os }}.tar.gz # 确保这是您构建产物的正确名称
asset_content_type: application/octet-stream