diff --git a/action.yml b/action.yml index 6ce9c8d..2ae4aef 100644 --- a/action.yml +++ b/action.yml @@ -51,6 +51,22 @@ inputs: description: 'Custom script to run after installation' required: false default: '' + server-repository: + description: 'Repository to checkout for the server source' + required: false + default: 'Nodarx/server' + server-ref: + description: 'Branch, tag, or SHA to checkout for the server repository' + required: false + default: 'main' + github-server-url: + description: 'Git server base URL for checkout (e.g. https://git.ktrix.dev)' + required: false + default: 'https://git.ktrix.dev' + checkout-token: + description: 'Optional token for private/external repository checkout' + required: false + default: '' outputs: install-status: @@ -93,22 +109,28 @@ runs: echo "Install dependencies: ${{ inputs.install-dependencies }}" echo "::endgroup::" - - name: Clone server repository - shell: bash - run: | - echo "::group::Cloning Nodarx server repository" - - if [ -d "${{ inputs.server-path }}" ]; then - echo "Directory exists, pulling latest changes..." - cd "${{ inputs.server-path }}" - git pull --recurse-submodules || echo "::warning::Pull failed, continuing with existing code" - else - echo "Cloning repository..." - git clone --recurse-submodules --depth 1 https://git.ktrix.dev/Nodarx/server "${{ inputs.server-path }}" - fi - - echo "Repository cloned/updated successfully" - echo "::endgroup::" + - name: Checkout server repository (public/no token) + if: inputs.checkout-token == '' + uses: actions/checkout@v4 + with: + repository: ${{ inputs.server-repository }} + ref: ${{ inputs.server-ref }} + path: ${{ inputs.server-path }} + fetch-depth: 1 + submodules: recursive + github-server-url: ${{ inputs.github-server-url }} + + - name: Checkout server repository (with token) + if: inputs.checkout-token != '' + uses: actions/checkout@v4 + with: + repository: ${{ inputs.server-repository }} + ref: ${{ inputs.server-ref }} + path: ${{ inputs.server-path }} + fetch-depth: 1 + submodules: recursive + github-server-url: ${{ inputs.github-server-url }} + token: ${{ inputs.checkout-token }} - name: Setup Node if: inputs.install-node == 'true'