first commit
This commit is contained in:
27
.gitea/workflows/master.yaml
Normal file
27
.gitea/workflows/master.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
version:
|
||||
name: "CD > 計算版本號"
|
||||
runs-on: ubuntu
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: 計算版本號
|
||||
id: version
|
||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }}
|
||||
release:
|
||||
name: "CD > 發布專案"
|
||||
runs-on: ubuntu
|
||||
needs: version
|
||||
steps:
|
||||
- name: 發布專案
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
||||
with:
|
||||
tag_name: "v${{ needs.version.outputs.version }}"
|
||||
- name: 清理成品
|
||||
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
||||
with:
|
||||
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
||||
24
action.yml
Normal file
24
action.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: 'CLEANUP DOCKER'
|
||||
description: '清理 Docker 沒用到的資源'
|
||||
author: 'Jeffery'
|
||||
inputs:
|
||||
DISK_USAGE_THRESHOLD:
|
||||
description: '磁碟使用量閾值'
|
||||
default: '80'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 取得磁碟使用率
|
||||
id: disk
|
||||
run: |
|
||||
USAGE=$(df / | awk 'NR==2{print $5}' | tr -d '%')
|
||||
echo "磁碟使用率:${USAGE}%"
|
||||
if [ "$USAGE" -gt "$DISK_USAGE_THRESHOLD" ]; then
|
||||
echo "should_prune=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "使用率為 ${USAGE}%,低於閾值,跳過清理"
|
||||
echo "should_prune=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: 清理 Docker 資源
|
||||
if: steps.disk.outputs.should_prune == 'true'
|
||||
run: docker system prune -af --volumes
|
||||
Reference in New Issue
Block a user