Compare commits
23 Commits
v0.3.1
...
4a6a3c159d
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a6a3c159d | |||
| 8cbe2e3e4d | |||
| 075bc62138 | |||
| 4a2c9d6064 | |||
| 17721ae9d0 | |||
| 9929c05469 | |||
| a078f2d984 | |||
| 9068f5e5b6 | |||
| e40a7adad6 | |||
| 214ec5f7bd | |||
| 829c119657 | |||
| 2ac7efe907 | |||
| 74e3e758c9 | |||
| 3e32b71abe | |||
| a8eaa2a293 | |||
| f6925cc5e7 | |||
| 2daf39673a | |||
| f3afba6e49 | |||
| c5b69ac380 | |||
| 963fa24ce0 | |||
| 93402e99ee | |||
| ac72d18016 | |||
| 70cac9e740 |
@@ -11,7 +11,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: 計算版本號
|
- name: 計算版本號
|
||||||
id: version
|
id: version
|
||||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }}
|
uses: https://gitea.jsc.idv.tw/actions/calculate-version-action@v${{ vars.CALCULATE_VERSION }}
|
||||||
with:
|
with:
|
||||||
gitea-server: ${{ gitea.server_url }}
|
gitea-server: ${{ gitea.server_url }}
|
||||||
repository: ${{ gitea.repository }}
|
repository: ${{ gitea.repository }}
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: "v${{ steps.version.outputs.VERSION }}"
|
tag_name: "v${{ steps.version.outputs.VERSION }}"
|
||||||
- name: 清理舊版本 (保留最新2個)
|
- name: 清理舊版本 (保留最新2個)
|
||||||
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
uses: https://gitea.jsc.idv.tw/actions/cleanup-release-action@v${{ vars.CLEANUP_RELEASE_VERSION }}
|
||||||
with:
|
with:
|
||||||
gitea-server: ${{ gitea.server_url }}
|
gitea-server: ${{ gitea.server_url }}
|
||||||
repository: ${{ gitea.repository }}
|
repository: ${{ gitea.repository }}
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -1,11 +0,0 @@
|
|||||||
FROM alpine:3.21
|
|
||||||
|
|
||||||
RUN apk add --no-cache bash curl jq
|
|
||||||
|
|
||||||
COPY cleanup-releases.sh /cleanup-releases.sh
|
|
||||||
COPY cleanup-images.sh /cleanup-images.sh
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
RUN chmod +x /cleanup-releases.sh /cleanup-images.sh /entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
36
action.yml
36
action.yml
@@ -23,12 +23,30 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'composite'
|
||||||
image: 'Dockerfile'
|
steps:
|
||||||
env:
|
- name: 清理舊版本
|
||||||
GITEA_SERVER: ${{ inputs.gitea-server }}
|
id: cleanup
|
||||||
REPOSITORY: ${{ inputs.repository }}
|
shell: bash
|
||||||
PACKAGE_NAME: ${{ inputs.package-name }}
|
run: |
|
||||||
TOKEN: ${{ inputs.token }}
|
chmod +x "${{ github.action_path }}/cleanup-releases.sh"
|
||||||
KEEP_COUNT: ${{ inputs.keep-count }}
|
"${{ github.action_path }}/cleanup-releases.sh" \
|
||||||
DRY_RUN: ${{ inputs.dry-run }}
|
"${{ inputs.gitea-server }}" \
|
||||||
|
"${{ inputs.repository }}" \
|
||||||
|
"${{ inputs.token }}" \
|
||||||
|
"${{ inputs.keep-count }}" \
|
||||||
|
"${{ inputs.dry-run }}"
|
||||||
|
|
||||||
|
- name: 清理舊映像
|
||||||
|
id: cleanup-images
|
||||||
|
if: inputs.package-name != ''
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
chmod +x "${{ github.action_path }}/cleanup-images.sh"
|
||||||
|
"${{ github.action_path }}/cleanup-images.sh" \
|
||||||
|
"${{ inputs.gitea-server }}" \
|
||||||
|
"${{ inputs.repository }}" \
|
||||||
|
"${{ inputs.package-name }}" \
|
||||||
|
"${{ inputs.token }}" \
|
||||||
|
"${{ inputs.keep-count }}" \
|
||||||
|
"${{ inputs.dry-run }}"
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
GITEA_SERVER="${GITEA_SERVER:-}"
|
|
||||||
REPOSITORY="${REPOSITORY:-}"
|
|
||||||
PACKAGE_NAME="${PACKAGE_NAME:-}"
|
|
||||||
TOKEN="${TOKEN:-}"
|
|
||||||
KEEP_COUNT="${KEEP_COUNT:-2}"
|
|
||||||
DRY_RUN="${DRY_RUN:-false}"
|
|
||||||
|
|
||||||
if [[ -z "$GITEA_SERVER" ]] || [[ -z "$REPOSITORY" ]] || [[ -z "$TOKEN" ]]; then
|
|
||||||
echo "❌ 錯誤:缺少必要的 inputs (gitea-server, repository, token)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
/cleanup-releases.sh "$GITEA_SERVER" "$REPOSITORY" "$TOKEN" "$KEEP_COUNT" "$DRY_RUN"
|
|
||||||
|
|
||||||
if [[ -n "$PACKAGE_NAME" ]]; then
|
|
||||||
/cleanup-images.sh "$GITEA_SERVER" "$REPOSITORY" "$PACKAGE_NAME" "$TOKEN" "$KEEP_COUNT" "$DRY_RUN"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user