Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
94 lines (87 loc) · 3.03 KB
/
Copy pathaction.yml
File metadata and controls
94 lines (87 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Set up Lest
description: Install a released lest binary on a Linux runner and put it on PATH.
branding:
icon: check-circle
color: green
inputs:
version:
description: Release to install, e.g. v0.1.3 or 0.1.3, or latest.
default: latest
install-browsers:
description: Also run `npx playwright install --with-deps chromium` in working-directory, for browser steps.
default: "false"
working-directory:
description: The flows project, where Playwright is installed.
default: "."
github-token:
description: Token for reading releases.
default: ${{ github.token }}
outputs:
version:
description: The installed version, without the leading v.
value: ${{ steps.resolve.outputs.version }}
runs:
using: composite
steps:
- id: resolve
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
WANT: ${{ inputs.version }}
REPO: open-cli-collective/lest
run: |
set -euo pipefail
if [ "$RUNNER_OS" != Linux ]; then
echo "::error::setup-lest supports Linux runners; elsewhere install with cargo install"
exit 1
fi
case "$RUNNER_ARCH" in
X64) arch=amd64 ;;
ARM64) arch=arm64 ;;
*) echo "::error::no lest build for $RUNNER_ARCH"; exit 1 ;;
esac
if [ "$WANT" = latest ]; then
tag="$(gh release view --repo "$REPO" --json tagName --jq .tagName)"
else
tag="v${WANT#v}"
fi
asset="lest_${tag}_linux_${arch}"
{
echo "tag=$tag"
echo "version=${tag#v}"
echo "asset=$asset"
echo "dir=$RUNNER_TOOL_CACHE/lest/$tag/$arch"
} >> "$GITHUB_OUTPUT"
- id: cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ${{ steps.resolve.outputs.dir }}
key: lest-${{ steps.resolve.outputs.asset }}
- if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
TAG: ${{ steps.resolve.outputs.tag }}
ASSET: ${{ steps.resolve.outputs.asset }}
DIR: ${{ steps.resolve.outputs.dir }}
REPO: open-cli-collective/lest
run: |
set -euo pipefail
tmp="$(mktemp -d)"
gh release download "$TAG" --repo "$REPO" --dir "$tmp" --pattern "$ASSET.tar.gz" --pattern checksums.txt
line="$(awk -v f="$ASSET.tar.gz" '$2 == f' "$tmp/checksums.txt")"
[ -n "$line" ] || { echo "::error::checksums.txt has no entry for $ASSET.tar.gz"; exit 1; }
(cd "$tmp" && printf '%s\n' "$line" | sha256sum --check --strict -)
mkdir -p "$DIR"
tar -xzf "$tmp/$ASSET.tar.gz" -C "$DIR" --strip-components=1
rm -rf "$tmp"
- shell: bash
env:
DIR: ${{ steps.resolve.outputs.dir }}
run: |
echo "$DIR" >> "$GITHUB_PATH"
"$DIR/lest" --version
- if: inputs.install-browsers == 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
run: npx playwright install --with-deps chromium