This commit is contained in:
28
.gitea/workflows/master.yaml
Normal file
28
.gitea/workflows/master.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
cd:
|
||||||
|
name: "CD > 發布專案"
|
||||||
|
runs-on: docker
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- name: 計算版本號
|
||||||
|
id: version
|
||||||
|
uses: https://gitea.jsc.idv.tw/jiantw83/calculate-version-action@v${{ vars.CALCULATE_VERSION }}
|
||||||
|
with:
|
||||||
|
gitea-server: ${{ gitea.server_url }}
|
||||||
|
repository: ${{ gitea.repository }}
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
- name: 發布專案
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
tag_name: "v${{ steps.version.outputs.VERSION }}"
|
||||||
|
- name: 清理舊版本 (保留最新2個)
|
||||||
|
uses: https://gitea.jsc.idv.tw/jiantw83/cleanup-release-action@v${{ vars.CLEANUP_RELEASE_VERSION }}
|
||||||
|
with:
|
||||||
|
gitea-server: ${{ gitea.server_url }}
|
||||||
|
repository: ${{ gitea.repository }}
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
38
action.yaml
Normal file
38
action.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: 'NUGET PUSH'
|
||||||
|
description: '打包套件'
|
||||||
|
author: 'Jeffery'
|
||||||
|
inputs:
|
||||||
|
token:
|
||||||
|
default: ''
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
source:
|
||||||
|
required: true
|
||||||
|
api_key:
|
||||||
|
required: true
|
||||||
|
index:
|
||||||
|
default: 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
|
||||||
Reference in New Issue
Block a user