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