-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
61 lines (61 loc) · 2.16 KB
/
action.yml
File metadata and controls
61 lines (61 loc) · 2.16 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
name: 'Setup wfctl'
description: 'Install the wfctl CLI tool for workflow engine operations'
inputs:
version:
description: 'wfctl version to install (e.g., "v0.3.51", "latest")'
required: false
default: 'latest'
token:
description: 'GitHub token for downloading releases'
required: false
default: ${{ github.token }}
runs:
using: 'composite'
steps:
- name: Determine version
id: version
shell: bash
run: |
if [ "${{ inputs.version }}" = "latest" ]; then
VERSION=$(curl -s https://api.github.com/repos/GoCodeAlone/workflow/releases/latest | grep '"tag_name"' | sed 's/.*"tag_name": "//;s/".*//')
else
VERSION="${{ inputs.version }}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Determine OS and arch
id: platform
shell: bash
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
esac
echo "os=${OS}" >> "$GITHUB_OUTPUT"
echo "arch=${ARCH}" >> "$GITHUB_OUTPUT"
- name: Cache wfctl
uses: actions/cache@v4
id: cache
with:
path: /usr/local/bin/wfctl
key: wfctl-${{ steps.version.outputs.version }}-${{ steps.platform.outputs.os }}-${{ steps.platform.outputs.arch }}
- name: Download wfctl
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
run: |
VERSION="${{ steps.version.outputs.version }}"
OS="${{ steps.platform.outputs.os }}"
ARCH="${{ steps.platform.outputs.arch }}"
# Release assets use hyphen separators and are bare binaries (no .tar.gz)
ASSET="wfctl-${OS}-${ARCH}"
URL="https://github.com/GoCodeAlone/workflow/releases/download/${VERSION}/${ASSET}"
echo "Downloading wfctl ${VERSION} for ${OS}/${ARCH}..."
curl -sL -H "Authorization: token ${GH_TOKEN}" "${URL}" -o /tmp/wfctl
sudo mv /tmp/wfctl /usr/local/bin/wfctl
chmod +x /usr/local/bin/wfctl
- name: Verify installation
shell: bash
run: wfctl version