ci: probe package auth
Probe / auth (push) Successful in 2s

This commit is contained in:
tri committed 2026-11-14 02:32:46 +07:00
1 parent c449402b04
commit 79ad449971
4 files changed
+23 -126

No files matched your search

-57
View File
@@ -1,57 +0,0 @@
name: Arch package
# Builds the qtpotato package from a release tag and publishes it to this Gitea's Arch
# registry, so users can install it with pacman until it is on the AUR.
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: Release tag to package, e.g. v0.1.0
required: true
permissions:
contents: read
packages: write
jobs:
package:
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
runs-on: amd64
container: archlinux:latest
env:
TAG: ${{ inputs.tag || github.ref_name }}
steps:
- name: Install dependencies
run: |
pacman -Syu --noconfirm --needed git nodejs base-devel cmake ninja extra-cmake-modules \
qt6-base qt6-declarative kirigami ki18n kcoreaddons kcrash kconfig \
mpvqt qcoro qtkeychain-qt6 ffmpeg hicolor-icon-theme
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Build
run: |
version="${TAG#v}"
dir=/tmp/pkg
mkdir -p "$dir"
git config --global --add safe.directory "$PWD"
git archive --format=tar --prefix="qtpotato-$version/" HEAD | gzip -n > "$dir/qtpotato-$version.tar.gz"
sum="$(sha256sum "$dir/qtpotato-$version.tar.gz" | cut -d' ' -f1)"
sed -e "s/^pkgver=.*/pkgver=$version/" -e "s/^pkgrel=.*/pkgrel=1/" \
-e 's/^source=.*/source=("$pkgname-$pkgver.tar.gz")/' \
-e "s/^sha256sums=.*/sha256sums=('$sum')/" \
packaging/aur/qtpotato/PKGBUILD > "$dir/PKGBUILD"
# makepkg refuses to run as root.
useradd -m builder
chown -R builder "$dir"
su builder -c "cd $dir && makepkg --noconfirm"
- name: Publish
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for f in /tmp/pkg/qtpotato-[0-9]*.pkg.tar.zst; do
curl -fsS -X PUT -H "Authorization: token $TOKEN" --upload-file "$f" \
"$GITHUB_SERVER_URL/api/packages/${GITHUB_REPOSITORY%%/*}/arch/qtpotato"
done
-27
View File
@@ -1,27 +0,0 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
build:
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
runs-on: amd64
container: archlinux:latest
steps:
- name: Install dependencies
run: |
pacman -Syu --noconfirm --needed git nodejs base-devel cmake ninja extra-cmake-modules \
qt6-base qt6-declarative kirigami ki18n kcoreaddons kcrash kconfig \
mpvqt qcoro qtkeychain-qt6 ffmpeg
- uses: actions/checkout@v4
- name: Configure
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON
- name: Build
run: cmake --build build
- name: Test
env:
QT_QPA_PLATFORM: offscreen
run: ctest --test-dir build --output-on-failure
+23
View File
@@ -0,0 +1,23 @@
name: Probe
on:
push:
branches: ['probe/**']
permissions:
contents: read
packages: write
jobs:
auth:
runs-on: ubuntu-latest
steps:
- env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
GT: ${{ secrets.GITEA_TOKEN }}
run: |
echo junk > /tmp/junk.pkg.tar.zst
u="$GITHUB_SERVER_URL/api/packages/${GITHUB_REPOSITORY%%/*}/arch/probe"
echo "actor=$GITHUB_ACTOR same=$([ "$TOKEN" = "$GT" ] && echo yes || echo no)"
echo -n "header token: "; curl -s -o /dev/null -w '%{http_code}\n' -X PUT -H "Authorization: token $TOKEN" --upload-file /tmp/junk.pkg.tar.zst "$u"
echo -n "bearer: "; curl -s -o /dev/null -w '%{http_code}\n' -X PUT -H "Authorization: Bearer $TOKEN" --upload-file /tmp/junk.pkg.tar.zst "$u"
echo -n "basic actor: "; curl -s -o /dev/null -w '%{http_code}\n' -X PUT --user "$GITHUB_ACTOR:$TOKEN" --upload-file /tmp/junk.pkg.tar.zst "$u"
echo -n "basic x: "; curl -s -o /dev/null -w '%{http_code}\n' -X PUT --user "x:$TOKEN" --upload-file /tmp/junk.pkg.tar.zst "$u"
echo -n "api v1 user: "; curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: token $TOKEN" "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
-42
View File
@@ -1,42 +0,0 @@
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
runs-on: amd64
container: archlinux:latest
steps:
- name: Install dependencies
run: |
pacman -Syu --noconfirm --needed git nodejs curl jq
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Source tarball
run: |
git config --global --add safe.directory "$PWD"
version="${GITHUB_REF_NAME#v}"
mkdir -p dist
git archive --format=tar --prefix="qtpotato-$version/" "$GITHUB_REF_NAME" \
| gzip -n > "dist/qtpotato-$version.tar.gz"
- name: Publish release
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd dist
sha256sum -- * > SHA256SUMS
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
id=$(jq -n --arg tag "$GITHUB_REF_NAME" '{tag_name: $tag, name: ("QtPotato " + ($tag | ltrimstr("v")))}' \
| curl -fsS -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
--data @- "$api/releases" | jq -r .id)
for f in *; do
curl -fsS -X POST -H "Authorization: token $TOKEN" \
-F "attachment=@$f" "$api/releases/$id/assets?name=$f" > /dev/null
done