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