mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-02 03:10:28 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17a6efb458 | ||
|
|
5c982063f4 | ||
|
|
d15809d0ff | ||
|
|
fc28b6c995 | ||
|
|
dbea48787c | ||
|
|
5a0c826638 | ||
|
|
ba3d801fa2 | ||
|
|
aab5a1fdfb | ||
|
|
d612fc86be | ||
|
|
b3b9147ed7 | ||
|
|
f4abeafc99 | ||
|
|
0180de5ee1 | ||
|
|
008e9ca06e | ||
|
|
4d0d5ef7c9 | ||
|
|
56a03286db | ||
|
|
fc57aaa8ad | ||
|
|
996e798ea2 | ||
|
|
6132093ff5 |
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
@@ -25,15 +25,14 @@ jobs:
|
||||
os:
|
||||
- ubuntu-18.04
|
||||
tool:
|
||||
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,shellcheck,shfmt
|
||||
- cargo-hack@0.5.9,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.0,parse-changelog@0.4.5,cross@0.2.1,shellcheck@0.8.0,shfmt@3.4.2
|
||||
# NOTE: Specifying the version of valgrind and wasm-pack is not supported.
|
||||
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,shellcheck,shfmt,valgrind,wasm-pack,wasmtime
|
||||
- cargo-hack@0.5.12,cargo-llvm-cov@0.1.16,cargo-minimal-versions@0.1.2,parse-changelog@0.4.7,cross@0.2.1,shellcheck@0.8.0,shfmt@3.4.2,wasmtime@0.33.0
|
||||
include:
|
||||
- os: macos-10.15
|
||||
tool: cargo-hack@0.5.9,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.0,parse-changelog@0.4.5,cross@0.2.1,shellcheck@0.8.0,shfmt@3.4.2
|
||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,shellcheck,shfmt,wasm-pack,wasmtime
|
||||
- os: windows-2019
|
||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog
|
||||
- os: windows-2019
|
||||
tool: cargo-hack@0.5.9,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.0,parse-changelog@0.4.5,cross@0.2.1
|
||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -49,9 +48,9 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: taiki-e/github-actions/install@main
|
||||
with:
|
||||
tool: prettier,shellcheck,shfmt
|
||||
- uses: taiki-e/install-action@shellcheck
|
||||
- uses: taiki-e/install-action@shfmt
|
||||
- run: npm install prettier
|
||||
- run: shfmt -d $(git ls-files '*.sh')
|
||||
if: always()
|
||||
- run: npx prettier -c $(git ls-files '*.yml')
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,7 +1,6 @@
|
||||
node_modules
|
||||
package-lock.json
|
||||
package.json
|
||||
tmp
|
||||
|
||||
# For platform and editor specific settings, it is recommended to add to
|
||||
# a global .gitignore file.
|
||||
|
||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -10,9 +10,42 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.1.2] - 2022-01-21
|
||||
|
||||
- Update `cargo-hack@latest` to 0.5.12.
|
||||
- Update `cargo-llvm-cov@latest` to 0.1.16.
|
||||
- Update `cargo-minimal-versions@latest` to 0.1.2.
|
||||
- Update `parse-changelog@latest` to 0.4.7.
|
||||
|
||||
## [1.1.1] - 2022-01-21
|
||||
|
||||
- Update `cargo-hack@latest` to 0.5.11.
|
||||
|
||||
## [1.1.0] - 2022-01-09
|
||||
|
||||
- Support `valgrind`, `wasm-pack`, and `wasmtime`.
|
||||
|
||||
## [1.0.3] - 2022-01-06
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.1.15.
|
||||
|
||||
## [1.0.2] - 2022-01-05
|
||||
|
||||
- Update `cargo-minimal-versions@latest` to 0.1.1.
|
||||
|
||||
## [1.0.1] - 2022-01-05
|
||||
|
||||
- Fix error in cases where the release has been created but the binary has not yet been uploaded.
|
||||
|
||||
## [1.0.0] - 2021-12-30
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.0.0...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.1.2...HEAD
|
||||
[1.1.2]: https://github.com/taiki-e/install-action/compare/v1.1.1...v1.1.2
|
||||
[1.1.1]: https://github.com/taiki-e/install-action/compare/v1.1.0...v1.1.1
|
||||
[1.1.0]: https://github.com/taiki-e/install-action/compare/v1.0.3...v1.1.0
|
||||
[1.0.3]: https://github.com/taiki-e/install-action/compare/v1.0.2...v1.0.3
|
||||
[1.0.2]: https://github.com/taiki-e/install-action/compare/v1.0.1...v1.0.2
|
||||
[1.0.1]: https://github.com/taiki-e/install-action/compare/v1.0.0...v1.0.1
|
||||
[1.0.0]: https://github.com/taiki-e/install-action/releases/tag/v1.0.0
|
||||
|
||||
@@ -39,7 +39,7 @@ To install a specific version, use `@version` syntax:
|
||||
```yaml
|
||||
- uses: taiki-e/install-action@v1
|
||||
with:
|
||||
tool: cargo-hack@0.5.9
|
||||
tool: cargo-hack@0.5.11
|
||||
```
|
||||
|
||||
To install multiple tools:
|
||||
@@ -73,6 +73,9 @@ https://spdx.org/licenses
|
||||
| [**cross**](https://github.com/rust-embedded/cross) | `~/.cargo/bin` | [GitHub Releases](https://github.com/rust-embedded/cross/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/rust-embedded/cross/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/rust-embedded/cross/blob/HEAD/LICENSE-MIT) |
|
||||
| [**shellcheck**](https://www.shellcheck.net) | `/usr/local/bin` | [GitHub Releases](https://github.com/koalaman/shellcheck/releases) | Linux, macOS | [GPL-3.0-or-later](https://github.com/koalaman/shellcheck/blob/HEAD/LICENSE) |
|
||||
| [**shfmt**](https://github.com/mvdan/sh) | `/usr/local/bin` | [GitHub Releases](https://github.com/mvdan/sh/releases) | Linux, macOS | [BSD-3-Clause](https://github.com/mvdan/sh/blob/HEAD/LICENSE) |
|
||||
| [**valgrind**](https://valgrind.org) | `/snap/bin` | [snap](https://snapcraft.io/install/valgrind/ubuntu) | Linux | [GPL-2.0-or-later](https://valgrind.org/docs/manual/license.gpl.html) |
|
||||
| [**wasm-pack**](https://github.com/rustwasm/wasm-pack) | `~/.cargo/bin` | [GitHub Releases](https://github.com/rustwasm/wasm-pack/releases) | Linux, macOS | [Apache-2.0](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**wasmtime**](https://github.com/bytecodealliance/wasmtime) | `~/.cargo/bin` | [GitHub Releases](https://github.com/bytecodealliance/wasmtime/releases) | Linux, macOS | [Apache-2.0 WITH LLVM-exception](https://github.com/bytecodealliance/wasmtime/blob/HEAD/LICENSE) |
|
||||
|
||||
<!-- TODO:
|
||||
| [**cmake**](https://cmake.org) | | [GitHub Releases](https://github.com/Kitware/CMake/releases) | Linux, macOS, Windows | [BSD-3-Clause](https://github.com/Kitware/CMake/blob/HEAD/Copyright.txt) |
|
||||
|
||||
94
main.sh
94
main.sh
@@ -28,7 +28,7 @@ warn() {
|
||||
echo "::warning::$*"
|
||||
}
|
||||
info() {
|
||||
echo >&2 "info: $*"
|
||||
echo "info: $*"
|
||||
}
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
@@ -54,11 +54,18 @@ for tool in "${tools[@]}"; do
|
||||
tool="${tool%@*}"
|
||||
info "installing ${tool}@${version}"
|
||||
case "${tool}" in
|
||||
# https://github.com/taiki-e/cargo-hack/releases
|
||||
# https://github.com/taiki-e/cargo-llvm-cov/releases
|
||||
# https://github.com/taiki-e/cargo-minimal-versions/releases
|
||||
# https://github.com/taiki-e/parse-changelog/releases
|
||||
cargo-hack | cargo-llvm-cov | cargo-minimal-versions | parse-changelog)
|
||||
case "${tool}" in
|
||||
# https://github.com/taiki-e/cargo-hack/releases
|
||||
cargo-hack) latest_version="0.5.12" ;;
|
||||
# https://github.com/taiki-e/cargo-llvm-cov/releases
|
||||
cargo-llvm-cov) latest_version="0.1.16" ;;
|
||||
# https://github.com/taiki-e/cargo-minimal-versions/releases
|
||||
cargo-minimal-versions) latest_version="0.1.2" ;;
|
||||
# https://github.com/taiki-e/parse-changelog/releases
|
||||
parse-changelog) latest_version="0.4.7" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
repo="taiki-e/${tool}"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
@@ -67,14 +74,15 @@ for tool in "${tools[@]}"; do
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) url="https://github.com/${repo}/releases/latest/download/${tool}-${target}.tar.gz" ;;
|
||||
*) url="https://github.com/${repo}/releases/download/v${version}/${tool}-${target}.tar.gz" ;;
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}-${target}.tar.gz"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C ~/.cargo/bin
|
||||
;;
|
||||
# https://github.com/rust-embedded/cross/releases
|
||||
cross)
|
||||
# https://github.com/rust-embedded/cross/releases
|
||||
latest_version="0.2.1"
|
||||
repo="rust-embedded/cross"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
@@ -83,15 +91,15 @@ for tool in "${tools[@]}"; do
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) tag=$(retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://api.github.com/repos/${repo}/releases/latest | jq -r '.tag_name') ;;
|
||||
*) tag="v${version}" ;;
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/${tag}/cross-${tag}-${target}.tar.gz"
|
||||
url="https://github.com/${repo}/releases/download/v${version}/cross-v${version}-${target}.tar.gz"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C ~/.cargo/bin
|
||||
;;
|
||||
# https://github.com/koalaman/shellcheck/releases
|
||||
shellcheck)
|
||||
# https://github.com/koalaman/shellcheck/releases
|
||||
latest_version="0.8.0"
|
||||
repo="koalaman/shellcheck"
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
@@ -105,14 +113,15 @@ for tool in "${tools[@]}"; do
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) tag="$(retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://api.github.com/repos/${repo}/releases/latest | jq -r '.tag_name')" ;;
|
||||
*) tag="v${version}" ;;
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://github.com/${repo}/releases/download/${tag}/shellcheck-${tag}.${target}.x86_64.tar.xz" \
|
||||
| tar xJf - --strip-components 1 -C /usr/local/bin "shellcheck-${tag}/shellcheck"
|
||||
url="https://github.com/${repo}/releases/download/v${version}/shellcheck-v${version}.${target}.x86_64.tar.xz"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xJf - --strip-components 1 -C /usr/local/bin "shellcheck-v${version}/shellcheck"
|
||||
;;
|
||||
# https://github.com/mvdan/sh/releases
|
||||
shfmt)
|
||||
# https://github.com/mvdan/sh/releases
|
||||
latest_version="3.4.2"
|
||||
repo="mvdan/sh"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="linux_amd64" ;;
|
||||
@@ -121,12 +130,55 @@ for tool in "${tools[@]}"; do
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) tag="$(retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://api.github.com/repos/${repo}/releases/latest | jq -r '.tag_name')" ;;
|
||||
*) tag="v${version}" ;;
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o /usr/local/bin/shfmt "https://github.com/${repo}/releases/download/${tag}/shfmt_${tag}_${target}"
|
||||
url="https://github.com/${repo}/releases/download/v${version}/shfmt_v${version}_${target}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o /usr/local/bin/shfmt "${url}"
|
||||
chmod +x /usr/local/bin/shfmt
|
||||
;;
|
||||
valgrind)
|
||||
case "${OSTYPE}" in
|
||||
linux*) ;;
|
||||
darwin* | cygwin* | msys*) bail "${tool} for non-linux is not supported yet by this action" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) ;;
|
||||
*) warn "specifying the version of ${tool} is not supported yet by this action" ;;
|
||||
esac
|
||||
sudo apt-get -o Acquire::Retries=10 -qq update
|
||||
# libc6-dbg is needed to run Valgrind
|
||||
sudo apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y libc6-dbg
|
||||
# Use snap to install the latest Valgrind
|
||||
# https://snapcraft.io/install/valgrind/ubuntu
|
||||
sudo snap install valgrind --classic
|
||||
;;
|
||||
wasm-pack)
|
||||
# https://rustwasm.github.io/wasm-pack/installer
|
||||
case "${OSTYPE}" in
|
||||
linux* | darwin*) ;;
|
||||
cygwin* | msys*) bail "${tool} for windows is not supported yet by this action" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://rustwasm.github.io/wasm-pack/installer/init.sh | sh
|
||||
;;
|
||||
wasmtime)
|
||||
# https://github.com/bytecodealliance/wasmtime/releases
|
||||
latest_version="0.33.0"
|
||||
repo="bytecodealliance/wasmtime"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-linux" ;;
|
||||
darwin*) target="x86_64-macos" ;;
|
||||
cygwin* | msys*) bail "${tool} for windows is not supported yet by this action" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/bytecodealliance/wasmtime/releases/download/v${version}/wasmtime-v${version}-${target}.tar.xz"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xJf - --strip-components 1 -C ~/.cargo/bin "wasmtime-v${version}-${target}/wasmtime"
|
||||
;;
|
||||
*) bail "unsupported tool '${tool}'" ;;
|
||||
esac
|
||||
|
||||
@@ -135,5 +187,5 @@ for tool in "${tools[@]}"; do
|
||||
cargo-*) x cargo "${tool#cargo-}" --version ;;
|
||||
*) x "${tool}" --version ;;
|
||||
esac
|
||||
echo >&2
|
||||
echo
|
||||
done
|
||||
|
||||
@@ -16,12 +16,38 @@ bail() {
|
||||
echo >&2 "error: $*"
|
||||
exit 1
|
||||
}
|
||||
warn() {
|
||||
echo >&2 "warning: $*"
|
||||
}
|
||||
info() {
|
||||
echo >&2 "info: $*"
|
||||
}
|
||||
|
||||
version="${1:?}"
|
||||
version="${version#v}"
|
||||
tag="v${version}"
|
||||
if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$ ]]; then
|
||||
bail "invalid version format '${version}'"
|
||||
fi
|
||||
if [[ $# -gt 1 ]]; then
|
||||
bail "invalid argument '$2'"
|
||||
fi
|
||||
|
||||
# Make sure there is no uncommitted change.
|
||||
git diff --exit-code
|
||||
git diff --exit-code --staged
|
||||
|
||||
# Make sure that a valid release note for this version exists.
|
||||
# https://github.com/taiki-e/parse-changelog
|
||||
echo "============== CHANGELOG =============="
|
||||
parse-changelog CHANGELOG.md "${version}"
|
||||
echo "======================================="
|
||||
|
||||
if ! grep <CHANGELOG.md -E "^## \\[${version//./\\.}\\] - $(date --utc '+%Y-%m-%d')$" >/dev/null; then
|
||||
bail "not found section '[${version}] - $(date --utc '+%Y-%m-%d')' in CHANGELOG.md"
|
||||
fi
|
||||
if ! grep <CHANGELOG.md -E "^\\[${version//./\\.}\\]: " >/dev/null; then
|
||||
bail "not found link to [${version}] in CHANGELOG.md"
|
||||
fi
|
||||
|
||||
# Make sure the same release has not been created in the past.
|
||||
if gh release view "${tag}" &>/dev/null; then
|
||||
bail "tag '${tag}' has already been created and pushed"
|
||||
fi
|
||||
|
||||
tools=(
|
||||
cargo-hack
|
||||
@@ -31,58 +57,21 @@ tools=(
|
||||
cross
|
||||
shellcheck
|
||||
shfmt
|
||||
valgrind
|
||||
wasm-pack
|
||||
wasmtime
|
||||
)
|
||||
|
||||
# Parse arguments.
|
||||
version="${1:?}"
|
||||
version="${version#v}"
|
||||
tag="v${version}"
|
||||
if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$ ]]; then
|
||||
bail "invalid version format: '${version}'"
|
||||
fi
|
||||
if [[ "${2:-}" == "--dry-run" ]]; then
|
||||
dry_run="--dry-run"
|
||||
shift
|
||||
fi
|
||||
if [[ $# -gt 1 ]]; then
|
||||
bail "invalid argument: '$2'"
|
||||
fi
|
||||
|
||||
if [[ -z "${dry_run:-}" ]]; then
|
||||
git diff --exit-code
|
||||
git diff --exit-code --staged
|
||||
fi
|
||||
|
||||
# Make sure that a valid release note for this version exists.
|
||||
# https://github.com/taiki-e/parse-changelog
|
||||
echo "============== CHANGELOG =============="
|
||||
parse-changelog CHANGELOG.md "${version}"
|
||||
echo "======================================="
|
||||
|
||||
# Make sure the same release has not been created in the past.
|
||||
if gh release view "${tag}" &>/dev/null; then
|
||||
bail "tag '${tag}' has already been created and pushed"
|
||||
fi
|
||||
|
||||
# Exit if dry run.
|
||||
if [[ -n "${dry_run:-}" ]]; then
|
||||
warn "skip creating a new tag '${tag}' due to dry run"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
info "creating and pushing a new tag '${tag}'"
|
||||
|
||||
(
|
||||
set -x
|
||||
|
||||
git push origin main
|
||||
git tag "${tag}"
|
||||
git push origin --tags
|
||||
sleep 10
|
||||
|
||||
version_tag=v1
|
||||
version_tag="v${version%%.*}"
|
||||
git checkout -b "${version_tag}"
|
||||
git push origin -f refs/heads/"${version_tag}"
|
||||
git push origin refs/heads/"${version_tag}"
|
||||
if git --no-pager tag | grep -E "^${version_tag}$" &>/dev/null; then
|
||||
git tag -d "${version_tag}"
|
||||
git push --delete origin refs/tags/"${version_tag}"
|
||||
|
||||
Reference in New Issue
Block a user