import upstream GUKO 2026-06-23
This commit is contained in:
27
.github/workflows/ci.yml
vendored
Normal file
27
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Bash syntax
|
||||
run: bash -n release.sh install.sh release.sh scripts/security-scan.sh
|
||||
- name: Secret scan
|
||||
run: bash scripts/security-scan.sh
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
- name: Python compile
|
||||
run: python -m py_compile auth.py guko.py jiaoops.py telegram-bot/bot.py optional/update_from_nezha.py
|
||||
- name: Docker build
|
||||
run: docker build -f telegram-bot/Dockerfile .
|
||||
45
.github/workflows/docker-publish.yml
vendored
Normal file
45
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Login to GHCR
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
||||
- name: Build image
|
||||
run: |
|
||||
IMAGE=ghcr.io/${{ github.repository_owner }}/guko
|
||||
TAGS="-t $IMAGE:${{ github.sha }}"
|
||||
if [ "${{ github.ref_type }}" = "branch" ] && [ "${{ github.ref_name }}" = "main" ]; then
|
||||
TAGS="$TAGS -t $IMAGE:latest"
|
||||
fi
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
TAGS="$TAGS -t $IMAGE:${{ github.ref_name }} -t $IMAGE:latest"
|
||||
fi
|
||||
docker build -f telegram-bot/Dockerfile $TAGS .
|
||||
- name: Push image
|
||||
run: |
|
||||
IMAGE=ghcr.io/${{ github.repository_owner }}/guko
|
||||
docker push "$IMAGE:${{ github.sha }}"
|
||||
if [ "${{ github.ref_type }}" = "branch" ] && [ "${{ github.ref_name }}" = "main" ]; then
|
||||
docker push "$IMAGE:latest"
|
||||
fi
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
docker push "$IMAGE:${{ github.ref_name }}"
|
||||
docker push "$IMAGE:latest"
|
||||
fi
|
||||
66
.github/workflows/release.yml
vendored
Normal file
66
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Draft GitHub Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag to release, for example v0.1.1'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Resolve tag
|
||||
id: vars
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Build release notes from CHANGELOG
|
||||
shell: bash
|
||||
run: |
|
||||
tag="${{ steps.vars.outputs.tag }}"
|
||||
version="${tag#v}"
|
||||
awk -v version="$version" '
|
||||
index($0, "## [" version "]") == 1 { capture=1; next }
|
||||
capture && index($0, "## [") == 1 { exit }
|
||||
capture { print }
|
||||
' CHANGELOG.md > /tmp/release-notes.md
|
||||
if [ ! -s /tmp/release-notes.md ]; then
|
||||
printf 'Release %s\n' "$tag" > /tmp/release-notes.md
|
||||
fi
|
||||
- name: Create or update release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
tag="${{ steps.vars.outputs.tag }}"
|
||||
assets=(docker-compose.example.yml .env.example)
|
||||
existing=()
|
||||
for asset in "${assets[@]}"; do
|
||||
[ -f "$asset" ] && existing+=("$asset")
|
||||
done
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
gh release edit "$tag" --title "$tag" --notes-file /tmp/release-notes.md
|
||||
if [ ${#existing[@]} -gt 0 ]; then
|
||||
gh release upload "$tag" "${existing[@]}" --clobber
|
||||
fi
|
||||
else
|
||||
gh release create "$tag" "${existing[@]}" --title "$tag" --notes-file /tmp/release-notes.md
|
||||
fi
|
||||
Reference in New Issue
Block a user