diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index c22ee2d..98a6ec0 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -7,6 +7,12 @@ inputs: qlfile-template: description: "Djula template for qlfile. All environment variables are available in it's context" required: false + SSH_PASS: + description: 'Password for SSH session' + required: true + NGROK_AUTH_TOKEN: + description: 'Authentification token for ngrok' + required: true runs: using: composite @@ -25,12 +31,12 @@ runs: - name: Check inputs run: | - if [ -z "${{ secrets.SSH_PASS }}" ] + if [ -z "${{ inputs.SSH_PASS }}" ] then echo "SSH_PASS needs to be passed in the 'with' field." exit 1 fi - if [ -z "${{ secrets.NGROK_AUTH_TOKEN }}" ] + if [ -z "${{ inputs.NGROK_AUTH_TOKEN }}" ] then echo "NGROK_AUTH_TOKEN needs to be passed in the 'with' field." exit 1 @@ -46,7 +52,7 @@ runs: printf " [DONE]\n\n" echo "# Change the SSH user password" - echo "${{ secrets.SSH_PASS }}`n${{ secrets.SSH_PASS }}" | sudo passwd $(cat ssh_user) + echo "${{ inputs.SSH_PASS }}`n${{ inputs.SSH_PASS }}" | sudo passwd $(cat ssh_user) } elseif('${{ runner.os }}' -eq 'macOS') { @@ -59,7 +65,7 @@ runs: echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config >/dev/null sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist - echo "${{ secrets.SSH_PASS }}`n${{ secrets.SSH_PASS }}" | sudo passwd "root" + echo "${{ inputs.SSH_PASS }}`n${{ inputs.SSH_PASS }}" | sudo passwd "root" } elseif('${{ runner.os }}' -eq 'Windows') { @@ -90,7 +96,7 @@ runs: net start BvSshServer echo "# Change the SSH user password" - net user $env:UserName ${{ secrets.SSH_PASS }} + net user $env:UserName ${{ inputs.SSH_PASS }} } shell: pwsh @@ -101,13 +107,13 @@ runs: unzip ngrok.zip chmod +x ./ngrok echo "# Set ngrok with the given authentification token" - ./ngrok authtoken ${{ secrets.NGROK_AUTH_TOKEN }} + ./ngrok authtoken ${{ inputs.NGROK_AUTH_TOKEN }} shell: bash - name: Start ngrok run: | printf "# Starting ngrok..." - ./ngrok tcp 22 --log ".ngrok.log" --region "${{ secrets.NGROK_REGION }}" & + ./ngrok tcp 22 --log ".ngrok.log" --region "${{ inputs.NGROK_REGION }}" & printf " [DONE]\n\n" printf "# Waiting for '.ngrok.log' file to be properly generated..." while ! grep -osqE "tcp://(.+)" .ngrok.log;do @@ -120,7 +126,7 @@ runs: printf " [DONE]\n\n" ssh_string=$(grep -oE "tcp://(.+)" .ngrok.log | sed "s/tcp:\/\//ssh $(cat ssh_user)@/" | sed "s/:/ -p /") continue_path=$(eval echo ~$(cat ssh_user)/continue) - time=${{ secrets.NGROK_TIMEOUT }} + time=${{ inputs.NGROK_TIMEOUT }} while [ ! -e $continue_path ] && [ $time -gt 1 ] do echo "" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b32041c..351c84f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -38,3 +38,6 @@ jobs: - uses: 40ants/cl-info/.github/actions/build-docs@custom-action with: asdf-system: cl-info + with: + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + SSH_PASS: ${{ secrets.SSH_PASS }}