-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: 'Setup asset of Github Releases' | ||
description: 'GitHub Action for gh-setup' | ||
inputs: | ||
github-token: | ||
description: The GitHub token | ||
default: ${{ github.token }} | ||
required: false | ||
repo: | ||
description: "Target repository [OWNER/REPO]" | ||
required: true | ||
bin-dir: | ||
description: "Executable path" | ||
default: "" | ||
required: false | ||
force: | ||
description: "Enable force setup" | ||
default: false | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
id: install-gh-setup | ||
run: scripts/install-gh-setup.sh | ||
shell: bash | ||
env: | ||
GH_SETUP_GITHUB_TOKEN: ${{ inputs.github-token }} | ||
- | ||
run: scripts/run-gh-setup.sh | ||
shell: bash | ||
env: | ||
GH_SETUP_GITHUB_TOKEN: ${{ inputs.github-token }} | ||
GH_SETUP_REPO: ${{ inputs.repo }} | ||
GH_SETUP_BIN_DIR: ${{ inputs.bin-dir }} | ||
GH_SETUP_FORCE: ${{ inputs.force }} | ||
GH_SETUP_BIN: ${{ steps.install-gh-setup.outputs.bin }} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
token=${GH_SETUP_GITHUB_TOKEN} | ||
if [ -z "${token}" ]; then | ||
token=${GITHUB_TOKEN} | ||
fi | ||
repo="k1LoW/gh-setup" | ||
tag="$(curl -sL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${token}" https://api.github.com/repos/${repo}/releases/latest | grep tag_name | awk -F':' '{print $2}' | awk -F'\"' '{print $2}')" | ||
arch="$(uname -m)" | ||
|
||
if uname -a | grep Msys > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="gh-setup_${tag}_windows_amd64.exe" | ||
fi | ||
bin="${TEMP}/gh-setup" | ||
elif uname -a | grep Darwin > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="gh-setup_${tag}_darwin_amd64" | ||
elif [ $arch = "arm64" ]; then | ||
exe="gh-setup_${tag}_darwin_arm64" | ||
fi | ||
bin="${TMPDIR}gh-setup" | ||
elif uname -a | grep Linux > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="gh-setup_${tag}_linux_amd64" | ||
fi | ||
bin="/tmp/gh-setup" | ||
fi | ||
|
||
# download | ||
curl -sL -o ${bin} https://github.com/k1LoW/gh-setup/releases/download/${tag}/${exe} | ||
chmod +x ${bin} | ||
${bin} -v | ||
echo "bin=${bin}" >> ${GITHUB_OUTPUT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
bin="${GH_SETUP_BIN}" | ||
token=${GH_SETUP_GITHUB_TOKEN} | ||
if [ -z "${token}" ]; then | ||
token=${GITHUB_TOKEN} | ||
fi | ||
repo=${GH_SETUP_REPO} | ||
bindir=${GH_SETUP_BIN_DIR} | ||
force=${GH_SETUP_FORCE} | ||
|
||
${bin} --repo ${repo} --bin-dir=${GH_SETUP_BIN_DIR} |