Skip to content

Fixed workflow

Fixed workflow #149

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
id-token: write
jobs:
lint:
name: lint
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Lint
run: |
docker buildx bake lint
unit-tests:
name: unit-tests
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Unit tests
run: |
docker buildx bake test
cli-test:
name: cli-test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Run CLI tests
run: |
docker buildx bake cli-test
release:
name: Release
needs:
- lint
- unit-tests
- cli-test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Build and release binaries
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
echo "Creating release for tag ${GITHUB_REF_NAME}"
docker buildx build \
--target publish \
--build-arg GITHUB_TOKEN \
--build-arg ACTIONS_ID_TOKEN_REQUEST_URL \
--build-arg ACTIONS_ID_TOKEN_REQUEST_TOKEN \
--build-arg GITHUB_REF_NAME \
.
image:
name: Build container image
needs:
- release
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: uniget-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install uniget
uses: uniget-org/uniget-action@v1
with:
prefix: helper
tools: jq regclient
- name: Fetch release asset
run: |
echo "### Downloading from release ${GITHUB_REF_NAME}"
for ARCH in x86_64 aarch64; do
echo "### Downloading for architecture ${ARCH}"
mkdir -p "dist/default_linux_${ARCH}"
curl --silent --show-error --location --fail \
"https://github.com/uniget-org/cli/releases/download/v${GITHUB_REF_NAME}/uniget_Linux_${ARCH}.tar.gz" \
| tar --extract --gzip --directory "dist/default_linux_${ARCH}" uniget
done
- name: Build container image
run: |
VERSION="$(
"dist/default_linux_${ARCH}/uniget" --version \
| cut -d' ' -f3
)"
docker build . \
--target systemd-uniget \
--platform linux/amd64,linux/arm64 \
--build-arg version="${VERSION}" \
--tag ghcr.io/uniget-org/uniget:${VERSION} \
--push
LATEST_VERSION="$(
./helper/usr/local/bin/regctl tag list ghcr.io/uniget-org/cli \
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
| sort -Vr \
| head -n 1
)"
./helper/usr/local/bin/regctl image copy \
"ghcr.io/uniget-org/uniget:${VERSION}" \
"ghcr.io/uniget-org/uniget:${LATEST_VERSION}"