102 lines
3.0 KiB
YAML
102 lines
3.0 KiB
YAML
name: Action Validation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags-ignore:
|
|
- "*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
validate-released-binary:
|
|
runs-on: ubuntu-latest
|
|
container: docker.io/catthehacker/ubuntu:act-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner_arch: X64
|
|
asset_arch: amd64
|
|
run_command: ./vociferate
|
|
- runner_arch: ARM64
|
|
asset_arch: arm64
|
|
run_command: qemu-aarch64-static ./vociferate
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install arm64 emulator
|
|
if: ${{ matrix.runner_arch == 'ARM64' }}
|
|
run: |
|
|
set -euo pipefail
|
|
apt-get update
|
|
apt-get install -y qemu-user-static
|
|
|
|
- name: Resolve latest released binary
|
|
id: resolve-binary
|
|
env:
|
|
API_URL: ${{ github.api_url }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
TOKEN: ${{ github.token }}
|
|
ASSET_ARCH: ${{ matrix.asset_arch }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
release_tag="$(curl -fsSL \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
"${API_URL}/repos/aether/vociferate/releases/latest" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)"
|
|
|
|
if [[ -z "$release_tag" ]]; then
|
|
echo "Unable to resolve latest vociferate release" >&2
|
|
exit 1
|
|
fi
|
|
|
|
normalized_version="${release_tag#v}"
|
|
asset_name="vociferate_${normalized_version}_linux_${ASSET_ARCH}"
|
|
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${release_tag}/${asset_name}"
|
|
|
|
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
|
|
echo "asset_name=$asset_name" >> "$GITHUB_OUTPUT"
|
|
echo "asset_url=$asset_url" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Download released binary
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
ASSET_URL: ${{ steps.resolve-binary.outputs.asset_url }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
curl --fail --location \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-o vociferate \
|
|
"$ASSET_URL"
|
|
chmod +x vociferate
|
|
|
|
- name: Smoke test released binary
|
|
env:
|
|
RUN_COMMAND: ${{ matrix.run_command }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
recommended_tag="$($RUN_COMMAND --recommend --root .)"
|
|
case "$recommended_tag" in
|
|
v*.*.*)
|
|
;;
|
|
*)
|
|
echo "Unexpected recommended tag: $recommended_tag" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
{
|
|
echo "## Released Binary Validation"
|
|
echo
|
|
echo "- Release tag: ${{ steps.resolve-binary.outputs.release_tag }}"
|
|
echo "- Asset: ${{ steps.resolve-binary.outputs.asset_name }}"
|
|
echo "- Recommended tag: ${recommended_tag}"
|
|
} >> "$GITHUB_STEP_SUMMARY" |