Skip to content

Commit

Permalink
feat: switch to use setup bin action (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed May 12, 2023
1 parent 3454e51 commit a511420
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sync-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: tj-actions/sync-release-version@v13
id: sync-release-version-action
with:
pattern: 'VERSION:-'
pattern: 'version: '
paths: |
action.yml
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ inputs:
runs:
using: 'composite'
steps:
- name: Setup bin
uses: tj-actions/setup-bin@v1
id: setup-bin-go
with:
version: v2.5.2
language-type: 'go'
- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
id: autodoc
Expand All @@ -57,7 +63,7 @@ runs:
INPUT_COL_MAX_WIDTH: ${{ inputs.col_max_width }}
INPUT_COL_MAX_WORDS: ${{ inputs.col_max_words }}
INPUT_OUTPUT: ${{ inputs.output }}
INPUT_BIN_PATH: ${{ inputs.bin_path }}
INPUT_BIN_PATH: ${{ inputs.bin_path || steps.setup-bin-go.outputs.binary_path }}
INPUT_INPUT_COLUMNS: ${{ inputs.input_columns }}
INPUT_OUTPUT_COLUMNS: ${{ inputs.output_columns }}
INPUT_REUSABLE_OUTPUT_COLUMNS: ${{ inputs.reusable_output_columns }}
Expand Down
39 changes: 0 additions & 39 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,45 +63,6 @@ if [[ "$REUSABLE" == "true" ]]; then
EXTRA_ARGS="${EXTRA_ARGS} --reusable"
fi

if [[ -z "$BIN_PATH" ]]; then
LATEST_VERSION=${VERSION:-v2.3.2}
echo "Downloading auto-doc $LATEST_VERSION binary..."

WINDOWS_TARGET=Windows_x86_64
LINUX_TARGET=Linux_x86_64
MACOS_TARGET=Darwin_x86_64
ARCHIVE=zip
TEMP_DIR=$(mktemp -d)

if [[ $(uname -s) == "Linux" ]]; then
TARGET=$LINUX_TARGET
ARCHIVE=tar.gz
elif [[ $(uname -s) == "Darwin" ]]; then
TARGET=$MACOS_TARGET
ARCHIVE=tar.gz
else
TARGET=$WINDOWS_TARGET
fi

DELAY=10
OUTPUT_FILE="$TEMP_DIR"/auto-doc."$ARCHIVE"

for i in $(seq 1 5); do
curl --connect-timeout 300 -sLf https://github.com/tj-actions/auto-doc/releases/download/"$LATEST_VERSION"/auto-doc_"${LATEST_VERSION/v/}"_"$TARGET"."$ARCHIVE" -o "$OUTPUT_FILE" && break
sleep $DELAY
echo "$i retries"
done

if [[ "$ARCHIVE" == "zip" ]]; then
unzip -q "$OUTPUT_FILE" -d "$TEMP_DIR"
else
tar -xzf "$OUTPUT_FILE" -C "$TEMP_DIR"
fi

chmod +x "$TEMP_DIR"/auto-doc
BIN_PATH="$TEMP_DIR"/auto-doc
fi

echo "::debug::Generating documentation using ${BIN_PATH}..."
echo "::debug::Extra args: ${EXTRA_ARGS}"

Expand Down

0 comments on commit a511420

Please sign in to comment.