From 59efcd7874f004840ae9ae877d708c6a8d0a539c Mon Sep 17 00:00:00 2001 From: Jeffery Date: Wed, 6 May 2026 10:19:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A8=AD=E5=AE=9A=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=EF=BC=8C=E5=8F=96=E5=BE=97=E5=B0=88=E6=A1=88=20->=20?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E6=9C=8D=E5=8B=99=20->=20=E5=95=9F=E5=8B=95?= =?UTF-8?q?=E6=9C=8D=E5=8B=99=20->=20=E6=B8=85=E7=90=86=E6=98=A0=E5=83=8F?= =?UTF-8?q?=E6=AA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot --- action.yml | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/action.yml b/action.yml index 028357c..6890bd2 100644 --- a/action.yml +++ b/action.yml @@ -1,31 +1,30 @@ -name: 'Composite Action Template' -description: 'Composite Action 範本' +name: 'DOCKER UP' +description: '部屬 Docker 映像檔' author: 'Jeffery' inputs: - runner_token: - description: 'Gitea Runner Token' - required: true - text: - description: '輸入的文字' - default: "Hello, World!" -outputs: - text: - description: '輸出的文字' - value: ${{ steps.display.outputs.text }} + SERVICE_NAME: + description: '服務名稱' + required: false runs: using: 'composite' steps: - - name: 顯示資訊 - id: display - env: - GITEA_SERVER_URL: ${{ gitea.server_url }} - GITEA_REPOSITORY: ${{ gitea.repository }} - RUNNER_TOKEN: ${{ inputs.runner_token }} - TEXT: ${{ inputs.text }} - run: | - echo "Gitea Server Url: $GITEA_SERVER_URL" - echo "Gitea Repository: $GITEA_REPOSITORY" - echo "Gitea Runner Token: $RUNNER_TOKEN" - echo "Input Text: $TEXT" - echo "text=$TEXT" >> "$GITHUB_OUTPUT" - shell: bash \ No newline at end of file + - name: 取得專案 + uses: actions/checkout@v6 + - name: 停止服務 + if: ${{ inputs.SERVICE_NAME != '' }} + run: docker compose down ${{ inputs.SERVICE_NAME }} + shell: bash + - name: 停止服務 + if: ${{ inputs.SERVICE_NAME == '' }} + run: docker compose down + shell: bash + - name: 啟動服務 + if: ${{ inputs.SERVICE_NAME != '' }} + run: docker compose up -d ${{ inputs.SERVICE_NAME }} + shell: bash + - name: 啟動服務 + if: ${{ inputs.SERVICE_NAME == '' }} + run: docker compose up -d + shell: bash + - name: 清理映像檔 + uses: https://gitea.jsc.idv.tw/actions/cleanup-docker@v0.0.3 \ No newline at end of file