first commit
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Sync to CNB / sync (push) Has been cancelled
Delete old workflow runs / del_runs (push) Has been cancelled
Upstream Sync / Sync latest commits from upstream repo (push) Has been cancelled

This commit is contained in:
2026-01-30 16:57:44 +08:00
commit 3d175d75af
119 changed files with 35834 additions and 0 deletions

51
.github/workflows/clean-up.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: Delete old workflow runs
on:
schedule:
- cron: '0 0 * * *'
jobs:
del_runs:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6
# Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.)
- name: 🎟 Get GitHub App token
uses: actions/create-github-app-token@v1
id: get-token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Delete workflow runs for current repo
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Delete deployment
uses: strumwolf/delete-deployment-environment@v2.3.0
with:
token: ${{ steps.get-token.outputs.token }}
environment: Preview
onlyRemoveDeployments: true
- name: Delete MAIN deployment
uses: strumwolf/delete-deployment-environment@v2.3.0
with:
token: ${{ steps.get-token.outputs.token }}
environment: Production
onlyRemoveDeployments: true

75
.github/workflows/docker-build.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '.cnb.yml'
- '.gitignore'
- '.github/workflows/clean-up.yml'
- '.cnb/web_trigger.yml'
pull_request:
branches:
- main
paths-ignore:
- 'README.md'
- '.gitignore'
- '.cnb.yml'
- '.github/workflows/clean-up.yml'
- '.cnb/web_trigger.yml'
permissions:
contents: read
packages: write
id-token: write
actions: write
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into GHCR
uses: docker/login-action@master
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64/v8
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ env.OWNER_LC }}/i-tools:latest
${{ vars.DOCKERHUB_USERNAME }}/i-tools:latest
- name: Post build cleanup
run: docker builder prune --force

23
.github/workflows/sync-to-cnb.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Sync to CNB
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Sync to CNB Repository
run: |
docker run --rm \
-v ${{ github.workspace }}:${{ github.workspace }} \
-w ${{ github.workspace }} \
-e PLUGIN_TARGET_URL="https://cnb.cool/ilay1678/i-tools.git" \
-e PLUGIN_AUTH_TYPE="https" \
-e PLUGIN_USERNAME="cnb" \
-e PLUGIN_PASSWORD=${{ secrets.CNB_TOKEN }} \
-e PLUGIN_SYNC_MODE="rebase" \
tencentcom/git-sync

36
.github/workflows/sync.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Upstream Sync
permissions:
contents: write
on:
schedule:
- cron: "0 4 * * *" # At 12PM UTC+8
workflow_dispatch:
jobs:
sync_latest_from_upstream:
name: Sync latest commits from upstream repo
runs-on: ubuntu-latest
if: ${{ github.repository != 'iLay1678/i-tools' }}
steps:
# Step 1: run a standard checkout action
- name: Checkout target repo
uses: actions/checkout@v4
# Step 2: run the sync action
- name: Sync upstream changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1
with:
upstream_sync_repo: iLay1678/i-tools
upstream_sync_branch: main
target_sync_branch: main
target_repo_token: ${{ github.token }}
- name: Sync check
if: failure()
run: |
echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork."
exit 1