Compare commits
4 Commits
8cbe2e3e4d
...
v0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea8b72ce8f | ||
| 0d7cdd65ca | |||
| 99ae6a157b | |||
| 3bd0ecaa98 |
@@ -11,17 +11,17 @@ jobs:
|
||||
steps:
|
||||
- name: 計算版本號
|
||||
id: version
|
||||
uses: https://gitea.jsc.idv.tw/jiantw83/calculate-version-action@v${{ vars.CALCULATE_VERSION }}
|
||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }}
|
||||
with:
|
||||
gitea-server: ${{ gitea.server_url }}
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
- name: 發布專案
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
||||
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 }}
|
||||
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
||||
with:
|
||||
gitea-server: ${{ gitea.server_url }}
|
||||
repository: ${{ gitea.repository }}
|
||||
|
||||
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
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"]
|
||||
29
action.yml
29
action.yml
@@ -23,30 +23,5 @@ inputs:
|
||||
required: false
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 清理舊版本
|
||||
id: cleanup
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x "${{ github.action_path }}/cleanup-releases.sh"
|
||||
"${{ github.action_path }}/cleanup-releases.sh" \
|
||||
"${{ 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 }}"
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
||||
16
entrypoint.sh
Normal file
16
entrypoint.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GITEA_SERVER="${INPUT_GITEA_SERVER}"
|
||||
REPOSITORY="${INPUT_REPOSITORY}"
|
||||
PACKAGE_NAME="${INPUT_PACKAGE_NAME:-}"
|
||||
TOKEN="${INPUT_TOKEN}"
|
||||
KEEP_COUNT="${INPUT_KEEP_COUNT:-2}"
|
||||
DRY_RUN="${INPUT_DRY_RUN:-false}"
|
||||
|
||||
/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