Update .gitea/workflows/deploy-ci.yaml
This commit is contained in:
@@ -7,6 +7,8 @@ env:
|
|||||||
GITEA_API: https://${{ vars.CONTAINER_REGISTRY }}/api/v1
|
GITEA_API: https://${{ vars.CONTAINER_REGISTRY }}/api/v1
|
||||||
TEMPLATE_PATH: .gitea/workflows/ci.yml
|
TEMPLATE_PATH: .gitea/workflows/ci.yml
|
||||||
IMAGE_NAME: osc/skins-image
|
IMAGE_NAME: osc/skins-image
|
||||||
|
ARTIFACT_PATH: "/data"
|
||||||
|
REPO_LIST_FILE: "/data/valid_repos.txt"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fetch-template:
|
fetch-template:
|
||||||
@@ -39,15 +41,17 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
outputs:
|
outputs:
|
||||||
repo_list: ${{ steps.save-repos.outputs.repo_list }}
|
repo_file: ${{ steps.save-repos.outputs.repo_file }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- id: find-repos
|
- id: find-repos
|
||||||
name: Scan All Users for Valid Skin Repositories
|
name: Scan All Users for Valid Skin Repositories
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
mkdir -p "$ARTIFACT_PATH"
|
||||||
|
repo_file="$REPO_LIST_FILE"
|
||||||
echo "🔍 Scanning users for repositories with 'Skins' directory"
|
echo "🔍 Scanning users for repositories with 'Skins' directory"
|
||||||
repo_file="valid_repos.txt"
|
|
||||||
page=1
|
page=1
|
||||||
total_valid=0
|
total_valid=0
|
||||||
user_index=1
|
user_index=1
|
||||||
@@ -82,13 +86,18 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "✅ Discovery complete — $total_valid valid repositories"
|
echo "✅ Discovery complete — $total_valid valid repositories"
|
||||||
echo "repo_list=$repo_file" >> $GITHUB_OUTPUT
|
echo "repo_file=$repo_file" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- id: save-repos
|
- id: save-repos
|
||||||
name: Save Valid Repository List
|
name: Save Repository List Output
|
||||||
run: |
|
run: echo "repo_file=$REPO_LIST_FILE" >> $GITHUB_OUTPUT
|
||||||
echo "Valid repos saved to file"
|
|
||||||
echo "repo_list=valid_repos.txt" >> $GITHUB_OUTPUT
|
- name: Upload Valid Repo List Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: valid-repo-list
|
||||||
|
path: ${{ env.REPO_LIST_FILE }}
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
sync-template:
|
sync-template:
|
||||||
name: Sync CI Template
|
name: Sync CI Template
|
||||||
@@ -98,18 +107,22 @@ jobs:
|
|||||||
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Load Template Content
|
- name: Download Valid Repo List
|
||||||
run: echo "Loaded template content for update"
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: valid-repo-list
|
||||||
|
path: ${{ env.ARTIFACT_PATH }}
|
||||||
|
|
||||||
- name: Read Repository List
|
- name: Load Repository List
|
||||||
run: |
|
run: |
|
||||||
cp "${{ needs.discover-repositories.outputs.repo_list }}" repos.txt
|
|
||||||
echo "🗂️ Repositories to process:"
|
echo "🗂️ Repositories to process:"
|
||||||
cat repos.txt
|
cat "${{ env.REPO_LIST_FILE }}"
|
||||||
|
|
||||||
- name: Sync Template to Repositories
|
- name: Apply Template to Repositories
|
||||||
run: |
|
run: |
|
||||||
mapfile -t repos < repos.txt
|
set -eo pipefail
|
||||||
|
mapfile -t repos < "${{ env.REPO_LIST_FILE }}"
|
||||||
|
|
||||||
for repo_full in "${repos[@]}"; do
|
for repo_full in "${repos[@]}"; do
|
||||||
owner="${repo_full%%/*}"
|
owner="${repo_full%%/*}"
|
||||||
repo="${repo_full##*/}"
|
repo="${repo_full##*/}"
|
||||||
@@ -118,9 +131,7 @@ jobs:
|
|||||||
echo "🔧 Syncing CI to: $owner/$repo"
|
echo "🔧 Syncing CI to: $owner/$repo"
|
||||||
|
|
||||||
default_branch=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$api" | jq -r '.default_branch')
|
default_branch=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$api" | jq -r '.default_branch')
|
||||||
latest_tag=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$api/tags" | jq -r '.[0].name // empty')
|
|
||||||
url="$api/contents/$TEMPLATE_PATH"
|
url="$api/contents/$TEMPLATE_PATH"
|
||||||
|
|
||||||
sha=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
sha=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
||||||
|
|
||||||
if [[ -z "$sha" ]]; then
|
if [[ -z "$sha" ]]; then
|
||||||
@@ -144,4 +155,4 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
run: rm -f repos.txt
|
run: rm -f "${{ env.REPO_LIST_FILE }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user