mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-27 01:20:28 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c28a9b2f8c | ||
|
|
d334ea4167 | ||
|
|
535250de6e | ||
|
|
c5927f82cd | ||
|
|
f06ff66739 | ||
|
|
9983065757 | ||
|
|
92f66cb09d | ||
|
|
af68e07c71 | ||
|
|
c94ae05707 | ||
|
|
374e0c54c9 | ||
|
|
2e762384e0 | ||
|
|
038c2c6c1b | ||
|
|
e50d40cb78 | ||
|
|
decc7be9bf | ||
|
|
01ea03f457 | ||
|
|
de870dd7b6 | ||
|
|
7b2bc6ded8 | ||
|
|
49d23019d2 | ||
|
|
9ac80a595c | ||
|
|
a3c80c04ed | ||
|
|
200308111f | ||
|
|
5df67a7818 | ||
|
|
6a64a6dede | ||
|
|
6135833927 | ||
|
|
fb7c739bcd | ||
|
|
ff05552c79 | ||
|
|
d037a2617d | ||
|
|
2e9722e984 | ||
|
|
effa33c167 | ||
|
|
2e45a72791 | ||
|
|
17a6efb458 | ||
|
|
5c982063f4 | ||
|
|
d15809d0ff | ||
|
|
fc28b6c995 | ||
|
|
dbea48787c | ||
|
|
5a0c826638 | ||
|
|
ba3d801fa2 | ||
|
|
aab5a1fdfb | ||
|
|
d612fc86be | ||
|
|
b3b9147ed7 |
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -24,19 +24,21 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
tool:
|
||||
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,shellcheck,shfmt
|
||||
- cargo-hack@0.5.10,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.1,parse-changelog@0.4.6,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,nextest,shellcheck,shfmt,valgrind,wasm-pack,wasmtime
|
||||
- cargo-hack@0.5.12,cargo-llvm-cov@0.2.4,cargo-minimal-versions@0.1.3,parse-changelog@0.4.7,cross@0.2.1,nextest@0.9.11,shellcheck@0.8.0,shfmt@3.4.3,wasmtime@0.35.1
|
||||
# Nextest supports basic version ranges as well
|
||||
- nextest@0.9
|
||||
include:
|
||||
- os: macos-10.15
|
||||
tool: cargo-hack@0.5.10,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.1,parse-changelog@0.4.6,cross@0.2.1,shellcheck@0.8.0,shfmt@3.4.2
|
||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,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.10,cargo-llvm-cov@0.1.13,cargo-minimal-versions@0.1.1,parse-changelog@0.4.6,cross@0.2.1
|
||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: ./
|
||||
@@ -46,7 +48,7 @@ jobs:
|
||||
tidy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: taiki-e/install-action@shellcheck
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
if: github.repository_owner == 'taiki-e'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: taiki-e/create-gh-release-action@v1
|
||||
|
||||
76
CHANGELOG.md
76
CHANGELOG.md
@@ -10,6 +10,66 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.2.2] - 2022-03-18
|
||||
|
||||
- Support specifying the version of `nextest`. ([#2](https://github.com/taiki-e/install-action/pull/3), thanks @sunshowers)
|
||||
|
||||
## [1.2.1] - 2022-03-18
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.2.4.
|
||||
|
||||
## [1.2.0] - 2022-03-18
|
||||
|
||||
- Support `nextest`.
|
||||
|
||||
## [1.1.9] - 2022-03-10
|
||||
|
||||
- Update `wasmtime@latest` to 0.35.1.
|
||||
|
||||
## [1.1.8] - 2022-03-05
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.2.3.
|
||||
|
||||
## [1.1.7] - 2022-03-02
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.2.2.
|
||||
|
||||
## [1.1.6] - 2022-02-20
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.2.1.
|
||||
- Update `shfmt@latest` to 3.4.3.
|
||||
|
||||
## [1.1.5] - 2022-02-08
|
||||
|
||||
- Update `wasmtime@latest` to 0.34.0.
|
||||
|
||||
## [1.1.4] - 2022-02-06
|
||||
|
||||
- Update `cargo-llvm-cov@latest` to 0.2.0.
|
||||
|
||||
## [1.1.3] - 2022-02-06
|
||||
|
||||
- Update `cargo-minimal-versions@latest` to 0.1.3.
|
||||
|
||||
## [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.
|
||||
@@ -22,7 +82,21 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.0.2...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.2.2...HEAD
|
||||
[1.2.2]: https://github.com/taiki-e/install-action/compare/v1.2.1...v1.2.2
|
||||
[1.2.1]: https://github.com/taiki-e/install-action/compare/v1.2.0...v1.2.1
|
||||
[1.2.0]: https://github.com/taiki-e/install-action/compare/v1.1.9...v1.2.0
|
||||
[1.1.9]: https://github.com/taiki-e/install-action/compare/v1.1.8...v1.1.9
|
||||
[1.1.8]: https://github.com/taiki-e/install-action/compare/v1.1.7...v1.1.8
|
||||
[1.1.7]: https://github.com/taiki-e/install-action/compare/v1.1.6...v1.1.7
|
||||
[1.1.6]: https://github.com/taiki-e/install-action/compare/v1.1.5...v1.1.6
|
||||
[1.1.5]: https://github.com/taiki-e/install-action/compare/v1.1.4...v1.1.5
|
||||
[1.1.4]: https://github.com/taiki-e/install-action/compare/v1.1.3...v1.1.4
|
||||
[1.1.3]: https://github.com/taiki-e/install-action/compare/v1.1.2...v1.1.3
|
||||
[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:
|
||||
@@ -70,9 +70,13 @@ https://spdx.org/licenses
|
||||
| [**cargo-llvm-cov**](https://github.com/taiki-e/cargo-llvm-cov) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-llvm-cov/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-minimal-versions**](https://github.com/taiki-e/cargo-minimal-versions) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-minimal-versions/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-MIT) |
|
||||
| [**parse-changelog**](https://github.com/taiki-e/parse-changelog) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/parse-changelog/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-MIT) |
|
||||
| [**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) |
|
||||
| [**cross**](https://github.com/cross-rs/cross) | `~/.cargo/bin` | [GitHub Releases](https://github.com/cross-rs/cross/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-MIT) |
|
||||
| [**nextest**](https://github.com/nextest-rs/nextest) | `~/.cargo/bin` | [GitHub Releases](https://github.com/nextest-rs/nextest/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/nextest-rs/nextest/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) |
|
||||
|
||||
82
main.sh
82
main.sh
@@ -28,7 +28,7 @@ warn() {
|
||||
echo "::warning::$*"
|
||||
}
|
||||
info() {
|
||||
echo >&2 "info: $*"
|
||||
echo "info: $*"
|
||||
}
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
@@ -57,13 +57,13 @@ for tool in "${tools[@]}"; do
|
||||
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.10" ;;
|
||||
cargo-hack) latest_version="0.5.12" ;;
|
||||
# https://github.com/taiki-e/cargo-llvm-cov/releases
|
||||
cargo-llvm-cov) latest_version="0.1.13" ;;
|
||||
cargo-llvm-cov) latest_version="0.2.4" ;;
|
||||
# https://github.com/taiki-e/cargo-minimal-versions/releases
|
||||
cargo-minimal-versions) latest_version="0.1.1" ;;
|
||||
cargo-minimal-versions) latest_version="0.1.3" ;;
|
||||
# https://github.com/taiki-e/parse-changelog/releases
|
||||
parse-changelog) latest_version="0.4.6" ;;
|
||||
parse-changelog) latest_version="0.4.7" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
repo="taiki-e/${tool}"
|
||||
@@ -77,13 +77,14 @@ for tool in "${tools[@]}"; do
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}-${target}.tar.gz"
|
||||
# shellcheck disable=SC2086
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C ~/.cargo/bin
|
||||
| tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
;;
|
||||
cross)
|
||||
# https://github.com/rust-embedded/cross/releases
|
||||
# https://github.com/cross-rs/cross/releases
|
||||
latest_version="0.2.1"
|
||||
repo="rust-embedded/cross"
|
||||
repo="cross-rs/cross"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
darwin*) target="x86_64-apple-darwin" ;;
|
||||
@@ -94,8 +95,21 @@ for tool in "${tools[@]}"; do
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/cross-v${version}-${target}.tar.gz"
|
||||
# shellcheck disable=SC2086
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C ~/.cargo/bin
|
||||
| tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
;;
|
||||
nextest)
|
||||
# https://nexte.st/book/pre-built-binaries.html
|
||||
case "${OSTYPE}" in
|
||||
linux*) url="https://get.nexte.st/${version}/linux" ;;
|
||||
darwin*) url="https://get.nexte.st/${version}/mac" ;;
|
||||
cygwin* | msys*) url="https://get.nexte.st/${version}/windows-tar" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
# shellcheck disable=SC2086
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
;;
|
||||
shellcheck)
|
||||
# https://github.com/koalaman/shellcheck/releases
|
||||
@@ -121,7 +135,7 @@ for tool in "${tools[@]}"; do
|
||||
;;
|
||||
shfmt)
|
||||
# https://github.com/mvdan/sh/releases
|
||||
latest_version="3.4.2"
|
||||
latest_version="3.4.3"
|
||||
repo="mvdan/sh"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="linux_amd64" ;;
|
||||
@@ -136,13 +150,57 @@ for tool in "${tools[@]}"; do
|
||||
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
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq update
|
||||
# libc6-dbg is needed to run Valgrind
|
||||
retry 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
|
||||
retry 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.35.1"
|
||||
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"
|
||||
# shellcheck disable=SC2086
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xJf - --strip-components 1 -C ${CARGO_HOME:-~/.cargo}/bin "wasmtime-v${version}-${target}/wasmtime"
|
||||
;;
|
||||
*) bail "unsupported tool '${tool}'" ;;
|
||||
esac
|
||||
|
||||
info "${tool} installed at $(type -P "${tool}")"
|
||||
case "${tool}" in
|
||||
cargo-*) x cargo "${tool#cargo-}" --version ;;
|
||||
cargo-* | nextest) x cargo "${tool#cargo-}" --version ;;
|
||||
*) x "${tool}" --version ;;
|
||||
esac
|
||||
echo >&2
|
||||
echo
|
||||
done
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
# Publish a new release.
|
||||
#
|
||||
# USAGE:
|
||||
# ./tools/publish.sh <VERSION>
|
||||
#
|
||||
# NOTE:
|
||||
# Note:
|
||||
# - This script requires parse-changelog <https://github.com/taiki-e/parse-changelog>
|
||||
|
||||
cd "$(cd "$(dirname "$0")" && pwd)"/..
|
||||
|
||||
bail() {
|
||||
echo >&2 "error: $*"
|
||||
exit 1
|
||||
@@ -31,19 +30,50 @@ fi
|
||||
git diff --exit-code
|
||||
git diff --exit-code --staged
|
||||
|
||||
# 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
|
||||
|
||||
tags=$(git --no-pager tag)
|
||||
if [[ -n "${tags}" ]]; then
|
||||
# Make sure the same release does not exist in CHANGELOG.md.
|
||||
release_date=$(date --utc '+%Y-%m-%d')
|
||||
if grep -Eq "^## \\[${version//./\\.}\\] - ${release_date}$" CHANGELOG.md; then
|
||||
bail "release ${version} already exist in CHANGELOG.md"
|
||||
fi
|
||||
if grep -Eq "^\\[${version//./\\.}\\]: " CHANGELOG.md; then
|
||||
bail "link to ${version} already exist in CHANGELOG.md"
|
||||
fi
|
||||
|
||||
# Update changelog.
|
||||
remote_url=$(grep -E '^\[Unreleased\]: https://' CHANGELOG.md | sed 's/^\[Unreleased\]: //' | sed 's/\.\.\.HEAD$//')
|
||||
before_tag=$(sed <<<"${remote_url}" 's/^.*\/compare\///')
|
||||
remote_url=$(sed <<<"${remote_url}" 's/\/compare\/v.*$//')
|
||||
sed -i "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n## [${version}] - ${release_date}/" CHANGELOG.md
|
||||
sed -i "s#^\[Unreleased\]: https://.*#[Unreleased]: ${remote_url}/compare/v${version}...HEAD\\n[${version}]: ${remote_url}/compare/${before_tag}...v${version}#" CHANGELOG.md
|
||||
if ! grep -Eq "^## \\[${version//./\\.}\\] - ${release_date}$" CHANGELOG.md; then
|
||||
bail "failed to update CHANGELOG.md"
|
||||
fi
|
||||
if ! grep -Eq "^\\[${version//./\\.}\\]: " CHANGELOG.md; then
|
||||
bail "failed to update CHANGELOG.md"
|
||||
fi
|
||||
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 "======================================="
|
||||
|
||||
if ! grep <CHANGELOG.md -E "^\\[${version//./\\.}\\]: " >/dev/null; then
|
||||
bail "not found link to [${version}] in CHANGELOG.md"
|
||||
if ! git branch | grep -q '\* main'; then
|
||||
bail "current branch is not 'main'"
|
||||
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"
|
||||
if [[ -n "${tags}" ]]; then
|
||||
# Create a release commit.
|
||||
git add CHANGELOG.md
|
||||
git commit -m "Release ${version}"
|
||||
fi
|
||||
|
||||
tools=(
|
||||
@@ -52,21 +82,25 @@ tools=(
|
||||
cargo-minimal-versions
|
||||
parse-changelog
|
||||
cross
|
||||
nextest
|
||||
shellcheck
|
||||
shfmt
|
||||
valgrind
|
||||
wasm-pack
|
||||
wasmtime
|
||||
)
|
||||
|
||||
(
|
||||
set -x
|
||||
|
||||
git push origin main
|
||||
git tag "${tag}"
|
||||
git push origin main
|
||||
git push origin --tags
|
||||
|
||||
version_tag="v${version%%.*}"
|
||||
git checkout -b "${version_tag}"
|
||||
git push origin refs/heads/"${version_tag}"
|
||||
if git --no-pager tag | grep -E "^${version_tag}$" &>/dev/null; then
|
||||
if git --no-pager tag | grep -Eq "^${version_tag}$"; then
|
||||
git tag -d "${version_tag}"
|
||||
git push --delete origin refs/tags/"${version_tag}"
|
||||
fi
|
||||
@@ -84,7 +118,7 @@ for tool in "${tools[@]}"; do
|
||||
git add action.yml
|
||||
git commit -m "${tool}"
|
||||
git push origin -f refs/heads/"${tool}"
|
||||
if git --no-pager tag | grep -E "^${tool}$" &>/dev/null; then
|
||||
if git --no-pager tag | grep -Eq "^${tool}$"; then
|
||||
git tag -d "${tool}"
|
||||
git push --delete origin refs/tags/"${tool}"
|
||||
fi
|
||||
|
||||
@@ -2,17 +2,16 @@
|
||||
# shellcheck disable=SC2046
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
# USAGE:
|
||||
# ./tools/tidy.sh
|
||||
#
|
||||
# NOTE: This script requires the following tools:
|
||||
# Note: This script requires the following tools:
|
||||
# - shfmt
|
||||
# - prettier
|
||||
# - shellcheck
|
||||
|
||||
cd "$(cd "$(dirname "$0")" && pwd)"/..
|
||||
|
||||
x() {
|
||||
local cmd="$1"
|
||||
shift
|
||||
|
||||
Reference in New Issue
Block a user