feat: 重構 nuget push 工具
This commit is contained in:
46
action.yaml
46
action.yaml
@@ -1,38 +1,20 @@
|
||||
name: 'NUGET PUSH'
|
||||
description: '打包套件'
|
||||
description: '推送 NUGET 套件'
|
||||
author: 'Jeffery'
|
||||
inputs:
|
||||
token:
|
||||
default: ''
|
||||
version:
|
||||
RELEASE_VERSION:
|
||||
required: true
|
||||
source:
|
||||
required: true
|
||||
api_key:
|
||||
required: true
|
||||
index:
|
||||
description: '要推送的版本號,ex: ${{ needs.calculate.outputs.version }}'
|
||||
RELEASE_INDEX:
|
||||
default: 0
|
||||
description: '要推送的版本中第幾個成品,預設為 0'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
HEADER="Authorization: token ${{ inputs.token }}"
|
||||
SOURCE="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/tags/v${{ inputs.version }}"
|
||||
echo "HEADER: $HEADER"
|
||||
echo "SOURCE: $SOURCE"
|
||||
|
||||
RELEASE_JSON="$(curl -s -H "$HEADER" "$SOURCE")"
|
||||
DOWNLOAD_NAME="$(echo "$RELEASE_JSON" | jq -r ".assets[${{ inputs.index }}].name")"
|
||||
DOWNLOAD_URL="$(echo "$RELEASE_JSON" | jq -r ".assets[${{ inputs.index }}].browser_download_url")"
|
||||
|
||||
echo "DOWNLOAD_NAME: $DOWNLOAD_NAME"
|
||||
echo "DOWNLOAD_URL: $DOWNLOAD_URL"
|
||||
|
||||
echo "ARTIFACT DOWNLOADING..."
|
||||
curl -s -H "$HEADER" "$DOWNLOAD_URL" -o "$DOWNLOAD_NAME"
|
||||
|
||||
echo "ARTIFACT UNZIPPING..."
|
||||
unzip "$DOWNLOAD_NAME" -d output
|
||||
|
||||
echo "ARTIFACT PUSHING..."
|
||||
dotnet nuget push "output/*.nupkg" --source "${{ inputs.source }}" --api-key "${{ inputs.api_key }}" --skip-duplicate --allow-insecure-connections
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
env:
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }}
|
||||
RELEASE_INDEX: ${{ inputs.RELEASE_INDEX }}
|
||||
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
||||
NUGET_AUTHOR: ${{ gitea.author }}
|
||||
Reference in New Issue
Block a user