Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56691b629b | |||
| 69e1b8a553 | |||
| a39202fd68 | |||
| 431fbe06f8 | |||
| 7e067f2f4b | |||
| 193f1d3312 | |||
| 29849ebc19 | |||
| 59bc31a756 |
@@ -21,10 +21,7 @@ jobs:
|
|||||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
||||||
with:
|
with:
|
||||||
tag_name: "v${{ needs.version.outputs.version }}"
|
tag_name: "v${{ needs.version.outputs.version }}"
|
||||||
test:
|
- name: 清理成品
|
||||||
name: "CD > 清理舊版成品"
|
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
||||||
runs-on: ubuntu
|
with:
|
||||||
needs: release
|
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
||||||
steps:
|
|
||||||
- name: 清理舊版成品
|
|
||||||
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
# 更新並安裝必要的工具
|
# 安裝必要的工具
|
||||||
RUN apk update \
|
RUN apk add --no-cache --no-check-certificate bash curl jq
|
||||||
&& apk add --no-cache bash curl jq
|
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ name: 'CLEANUP OLD RELEASES'
|
|||||||
description: '清理舊版成品'
|
description: '清理舊版成品'
|
||||||
author: 'Jeffery'
|
author: 'Jeffery'
|
||||||
inputs:
|
inputs:
|
||||||
|
RUNNER_TOKEN:
|
||||||
|
description: 'GitHub Runner Token'
|
||||||
KEEP_COUNT:
|
KEEP_COUNT:
|
||||||
description: '保留的版本數量'
|
description: '保留的版本數量'
|
||||||
default: '2'
|
default: '2'
|
||||||
@@ -11,5 +13,5 @@ runs:
|
|||||||
env:
|
env:
|
||||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
RUNNER_TOKEN: ${{ inputs.RUNNER_TOKEN || ${{ secrets.GITEA_TOKEN }} || secrets.RUNNER_TOKEN }}
|
||||||
KEEP_COUNT: ${{ inputs.KEEP_COUNT }}
|
KEEP_COUNT: ${{ inputs.KEEP_COUNT }}
|
||||||
@@ -40,7 +40,7 @@ fi
|
|||||||
|
|
||||||
# 計算成品數量並依照時間排序
|
# 計算成品數量並依照時間排序
|
||||||
RELEASE_JSON=$(echo "$RELEASE_JSON" | jq -e 'sort_by(.created_at) | reverse')
|
RELEASE_JSON=$(echo "$RELEASE_JSON" | jq -e 'sort_by(.created_at) | reverse')
|
||||||
RELEASE_COUNT=$(echo "$RELEASE_JSON" | jq 'length')
|
RELEASE_COUNT=$(echo "$RELEASE_JSON" | jq 'length') && echo "RELEASE_COUNT=$RELEASE_COUNT"
|
||||||
|
|
||||||
# 檢查成品數量是否需要清除
|
# 檢查成品數量是否需要清除
|
||||||
[ $RELEASE_COUNT -le $KEEP_COUNT ] && exit 0
|
[ $RELEASE_COUNT -le $KEEP_COUNT ] && exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user