Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf3194631f | ||
|
|
7426c5d835 | ||
|
|
58ae22ed1e | ||
|
|
4e236c8d0f | ||
|
|
d7cd868c04 | ||
|
|
3ca0c5a9ab | ||
|
|
8a9c4d1ca9 | ||
|
|
de7804c7d1 | ||
|
|
ccd4ef297e | ||
|
|
6ff37643b6 | ||
|
|
9a15897128 |
@@ -6,21 +6,31 @@ jobs:
|
|||||||
cd:
|
cd:
|
||||||
name: "CD > 發布專案"
|
name: "CD > 發布專案"
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
env:
|
|
||||||
RUNNER_TOOL_CACHE: /toolcache
|
|
||||||
steps:
|
steps:
|
||||||
- name: 發布專案
|
- name: 發布專案
|
||||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
|
||||||
with:
|
with:
|
||||||
tag_name: "v0.1.1"
|
tag_name: "v0.1.6"
|
||||||
- name: 計算版本號
|
|
||||||
id: version
|
|
||||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@v0.0.9
|
|
||||||
- name: 顯示資訊
|
|
||||||
run: echo ${{ needs.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@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
|
||||||
with:
|
with:
|
||||||
gitea-server: ${{ gitea.server_url }}
|
gitea-server: ${{ gitea.server_url }}
|
||||||
repository: ${{ gitea.repository }}
|
repository: ${{ gitea.repository }}
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
test-calculate:
|
||||||
|
name: "TEST > 計算版本號"
|
||||||
|
runs-on: docker
|
||||||
|
needs: cd
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: 計算版本號
|
||||||
|
id: version
|
||||||
|
uses: https://gitea.jsc.idv.tw/actions/calculate-version@v0.1.6
|
||||||
|
test:
|
||||||
|
name: "TEST > 測試專案"
|
||||||
|
runs-on: docker
|
||||||
|
needs: test-calculate
|
||||||
|
steps:
|
||||||
|
- name: 顯示版本號
|
||||||
|
run: echo ${{ needs.test-calculate.outputs.version }}
|
||||||
10
action.yaml
10
action.yaml
@@ -6,12 +6,18 @@ author: 'Jeffery'
|
|||||||
# description: 'Gitea Runner 用來存取的 Token,ex: ${{ secrets.RUNNER_TOKEN }}'
|
# description: 'Gitea Runner 用來存取的 Token,ex: ${{ secrets.RUNNER_TOKEN }}'
|
||||||
# required: true
|
# required: true
|
||||||
outputs:
|
outputs:
|
||||||
VERSION:
|
version:
|
||||||
description: '計算出的新版本號'
|
description: '計算出的新版本號'
|
||||||
|
value: ${{ steps.calculate.outputs.version }}
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
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: ${{ secrets.RUNNER_TOKEN }}
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: 將檔案寫到輸出
|
||||||
|
id: calculate
|
||||||
|
run: echo "VERSION.txt" >> $GITHUB_OUTPUT
|
||||||
@@ -67,8 +67,8 @@ PATCH=$((PATCH + 1))
|
|||||||
# 如果 MINOR >= 10,重置為 0 並增加 MAJOR 版本
|
# 如果 MINOR >= 10,重置為 0 並增加 MAJOR 版本
|
||||||
[ $MINOR -ge 10 ] && { MINOR=0; MAJOR=$((MAJOR + 1)); }
|
[ $MINOR -ge 10 ] && { MINOR=0; MAJOR=$((MAJOR + 1)); }
|
||||||
|
|
||||||
# 組合新的版本號
|
# 組合新的版本號,並顯示
|
||||||
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
|
NEW_VERSION="$MAJOR.$MINOR.$PATCH" && echo "NEW_VERSION=$NEW_VERSION"
|
||||||
|
|
||||||
# 將版本輸出到環境變數
|
# 將版本輸出到環境變數
|
||||||
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
echo "version=$NEW_VERSION" >> "VERSION.txt"
|
||||||
Reference in New Issue
Block a user