homebase_resident and archivetune #1878
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Pages | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - main | |
| paths: | |
| - 'newicons/appfilter.xml' | |
| push: | |
| branches: ['Arcticons-Pages', 'main'] | |
| paths: | |
| - 'docs/**' | |
| - 'newicons/appfilter.xml' | |
| - 'icons/**' | |
| schedule: | |
| # * is a special character in YAML so you have to quote this string | |
| - cron: '30 5 * * 0,3' | |
| workflow_run: | |
| workflows: [Auto Appfilter Updater,Crowdsource Appfilter] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| inputs: | |
| run_colormapping: | |
| description: "Run Create_Colormappping job" | |
| type: boolean | |
| required: false | |
| default: false | |
| run_requestjson: | |
| description: "Run Create_requestjson job" | |
| type: boolean | |
| required: false | |
| default: false | |
| run_Request_Update: | |
| description: "Run Update_Requests job" | |
| type: boolean | |
| required: false | |
| default: false | |
| run_fetch_and_push_file: | |
| description: "Run fetch_and_push_file job" | |
| type: boolean | |
| required: false | |
| default: false | |
| run_build_pages: | |
| description: "Run parse_and_combine job" | |
| type: boolean | |
| required: false | |
| default: false | |
| run_codeberg_sync: | |
| description: "Sync icons/ to Codeberg" | |
| type: boolean | |
| required: false | |
| default: false | |
| permissions: | |
| actions: none | |
| attestations: none | |
| checks: none | |
| contents: read | |
| deployments: none | |
| id-token: none | |
| issues: none | |
| discussions: none | |
| packages: none | |
| pages: none | |
| pull-requests: none | |
| repository-projects: none | |
| security-events: none | |
| statuses: none | |
| jobs: | |
| fetch_and_push_file: | |
| name: Fetch and Push File | |
| if: ${{ github.repository == vars.REPOSITORY && ((github.event_name == 'push' && github.ref_name == vars.MAIN_BRANCH) || (github.event_name == 'workflow_dispatch' && inputs.run_fetch_and_push_file == true)) }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: push | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| environment: | |
| name: FileSync | |
| env: | |
| SOURCE_BRANCH: ${{vars.MAIN_BRANCH}} | |
| TARGET_BRANCH: ${{vars.PAGES_BRANCH}} | |
| FILE_PATH: newicons/appfilter.xml | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout main Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.MAIN_BRANCH}} | |
| path: main | |
| - name: Checkout Arcticons-Pages Repository | |
| # Step 2: Checkout the 2. repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| path: pages | |
| - name: Copy File from main to Arcticons-Pages | |
| # Step 3: Fetch the file from the source branch | |
| run: | | |
| rm pages/newicons/appfilter.xml | |
| cp main/newicons/appfilter.xml pages/newicons/appfilter.xml | |
| - name: Commit and Push Changes | |
| # Step 4: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd pages | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add $FILE_PATH | |
| git commit -m "Update $FILE_PATH from $SOURCE_BRANCH to $TARGET_BRANCH" | |
| git push | |
| check_appfilter: | |
| name: Check appfilter.xml from pull_request | |
| if: github.event_name == 'pull_request_target' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| CommentPRtext: ${{ steps.validate.outputs.text }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.user.login }}/${{ github.event.pull_request.head.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout Repository ${{ github.event.pull_request.user.login }}/${{ github.event.pull_request.head.ref }} | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| sparse-checkout: | | |
| newicons/appfilter.xml | |
| sparse-checkout-cone-mode: false | |
| - name: Install xmllint | |
| shell: bash | |
| run: | | |
| sudo apt update | |
| sudo apt install -y libxml2-utils | |
| - name: Validate appfilter.xml | |
| id: validate | |
| run: | | |
| if ! PARSE_OUTPUT=$(xmllint --noout newicons/appfilter.xml 2>&1) ; then | |
| echo "Parsing appfilter.xml failed." | |
| echo -e "text=$PARSE_OUTPUT" >> "$GITHUB_OUTPUT" | |
| exit 1 | |
| else | |
| echo "Parsing succeeded." | |
| fi | |
| comment_pr_check_appfilter: | |
| name: Comment on PR | |
| needs: ['check_appfilter'] | |
| if: ${{failure()}} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write # Required to comment on PRs | |
| env: | |
| PARSE_OUTPUT: ${{needs.check_appfilter.outputs.CommentPRtext}} | |
| steps: | |
| - name: Create Comment | |
| run: echo -e "Parsing of 'newicons/appfilter.xml' failed. Please fix the XML syntax errors. \n \`\`\` \n $PARSE_OUTPUT \n \`\`\`" >> comment_markdown.md | |
| - name: Make Comment | |
| run: gh pr comment ${{ github.event.pull_request.number }} --body-file comment_markdown.md --repo ${{ github.repository }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| Update_Requests: | |
| if: ${{ github.repository == vars.REPOSITORY && ( inputs.run_Request_Update == true || github.event_name == 'schedule') && vars.AUTOMATIC_UPDATE == 'true' }} | |
| environment: | |
| name: Request-Update | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: 'push' | |
| cancel-in-progress: false | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes_detected: ${{ steps.check_changes.outputs.changes_detected }} | |
| request_changes: ${{ steps.check_changes.outputs.Request_changes }} | |
| image_changes: ${{ steps.check_changes.outputs.Image_changes }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| - run: pip install -r .github/workflows/requirements.txt | |
| - name: Execute Python Script | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REQUEST_LIMIT: ${{ vars.REQUEST_LIMIT }} | |
| MONTHS_LIMIT: ${{ vars.MONTHS_LIMIT }} | |
| MIN_REQUESTS: ${{ vars.MIN_REQUESTS }} | |
| SUBJECT_PREFIX: ${{ vars.SUBJECT_PREFIX }} | |
| SUBJECT_SUFFIX: ${{ vars.SUBJECT_SUFFIX }} | |
| IMAP_SERVER: ${{ secrets.IMAP_SERVER }} | |
| IMAP_USERNAME: ${{ secrets.IMAP_USERNAME }} | |
| IMAP_PASSWORD: ${{ secrets.IMAP_PASSWORD }} | |
| run: | | |
| mkdir mail | |
| python .github/workflows/email_parser_auto.py mail newicons/appfilter.xml docs/extracted_png docs/assets/ | |
| rm -r mail | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add -A | |
| # Get the list of changed files | |
| CHANGED_FILES=$(git diff --cached --name-only) | |
| # Check if there are any changes | |
| if [ -z "$CHANGED_FILES" ]; then | |
| echo "No changes detected" | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected" | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| # Set different outputs depending on which path changed | |
| if echo "$CHANGED_FILES" | grep -q "^docs/assets/requests.json"; then | |
| echo "Request_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q "^docs/extracted_png/"; then | |
| echo "Image_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| # You can add more checks for other directories or files here as needed | |
| fi | |
| - name: Commit and Push if Changes Exist | |
| if: ${{ steps.check_changes.outputs.changes_detected == 'true' }} | |
| run: | | |
| git commit -m "Automated Request Update" | |
| git push | |
| Check_FilePath: | |
| name: Check File Path changes | |
| if: ${{github.event_name == 'push' && github.ref_name == vars.PAGES_BRANCH}} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| imagechange: ${{ steps.changes.outputs.images }} | |
| requestchange: ${{ steps.changes.outputs.requests }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d | |
| id: changes | |
| with: | |
| filters: | | |
| images: | |
| - 'docs/extracted_png/**' | |
| requests: | |
| - 'docs/assets/requests.json' | |
| base: ${{vars.PAGES_BRANCH}} | |
| Create_Colormappping: | |
| name: Create Colormapping | |
| needs: [Check_FilePath, Update_Requests] | |
| if: ${{ ((needs.Check_FilePath.outputs.imagechange == 'true' && github.event_name == 'push') || (((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && needs.Update_Requests.outputs.image_changes == 'true') || (inputs.run_colormapping == true && inputs.run_Request_Update == false ))) && !failure() }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: 'colormapping' | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| - run: pip install -r .github/workflows/requirements.txt | |
| - name: Execute Python Script | |
| id: colormapping_done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python .github/workflows/create_colormapping.py | |
| - name: Upload Colormapping | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: colormapping | |
| path: docs/assets/image_color_counts.json | |
| Create_requestjson: | |
| name: Create Requestjson | |
| needs: [Check_FilePath, Update_Requests] | |
| if: ${{ ((needs.Check_FilePath.outputs.requestchange == 'true' && github.event_name == 'push') || (((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && needs.Update_Requests.outputs.request_changes == 'true') || (inputs.run_requestjson == true && inputs.run_Request_Update == false ))) && !failure() }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: 'requestjson' | |
| cancel-in-progress: true | |
| outputs: | |
| requestjson_done: ${{ steps.requestjson_done.outcome }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| - run: pip install -r .github/workflows/requirements.txt | |
| - name: Execute Python Script | |
| id: requestjson_done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python .github/workflows/getGPlayData.py | |
| - name: Upload Requestjson | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: requestjson | |
| path: docs/assets/requests.json | |
| Push_Files: | |
| needs: [Create_Colormappping, Create_requestjson] | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: 'push' | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| if: ${{(needs.Create_Colormappping.result == 'success' || needs.Create_requestjson.result == 'success') && !failure()}} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - name: Download Colormapping and Requestjson | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: docs/assets | |
| merge-multiple: true | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add -A | |
| # Get the list of changed files | |
| CHANGED_FILES=$(git diff --cached --name-only) | |
| # Check if there are any changes | |
| if [ -z "$CHANGED_FILES" ]; then | |
| echo "No changes detected" | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected" | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and Push if Changes Exist | |
| if: ${{ steps.check_changes.outputs.changes_detected == 'true' }} | |
| run: | | |
| git commit -m "Automated updates from Colormappping and Requestjson jobs" | |
| git push | |
| Sync_to_Codeberg: | |
| name: Sync icons subtree to Codeberg | |
| # Run if icons change on main branch, or if triggered manually | |
| if: ${{github.repository == vars.REPOSITORY && ((github.event_name == 'push' && contains(github.event.commits.*.modified, 'icons/')) ||(github.event_name == 'workflow_dispatch' && inputs.run_codeberg_sync == true))}} | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: Codeberg Icon Sync | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Subtree requires full history | |
| - name: Install SSH Key | |
| uses: shimataro/ssh-key-action@v2 | |
| with: | |
| key: ${{ secrets.SSH_KEY }} | |
| known_hosts: | | |
| codeberg.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL2pDxWr18SoiDJCGZ5LmxPygTlPu+cCKSkpqkvCyQzl5xmIMeKNdfdBpfbCGDPoZQghePzFZkKJNR/v9Win3Sc= | |
| codeberg.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIVIC02vnjFyL+I4RHfvIGNtOgJMe769VTF1VR4EB3ZB | |
| codeberg.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hZi7K1/2E2uBX8gwPRJAHvRAob+3Sn+y2hxiEhN0buv1igjYFTgFO2qQD8vLfU/HT/P/rqvEeTvaDfY1y/vcvQ8+YuUYyTwE2UaVU5aJv89y6PEZBYycaJCPdGIfZlLMmjilh/Sk8IWSEK6dQr+g686lu5cSWrFW60ixWpHpEVB26eRWin3lKYWSQGMwwKv4LwmW3ouqqs4Z4vsqRFqXJ/eCi3yhpT+nOjljXvZKiYTpYajqUC48IHAxTWugrKe1vXWOPxVXXMQEPsaIRc2hpK+v1LmfB7GnEGvF1UAKnEZbUuiD9PBEeD5a1MZQIzcoPWCrTxipEpuXQ5Tni4mN | |
| if_key_exists: fail | |
| - name: Push Subtree | |
| run: | | |
| git -c diff.renames=false subtree push \ | |
| --prefix=icons \ | |
| git@codeberg.org:Arcticons/Icons.git \ | |
| main | |
| parse_and_combine: | |
| name: Parse and Combine Appfilter | |
| needs: [check_appfilter, Push_Files, fetch_and_push_file, Update_Requests, Check_FilePath] | |
| if: ${{(github.event_name == 'workflow_run' || needs.Check_FilePath.result == 'success' ||needs.check_appfilter.result == 'success' || needs.Push_Files.result == 'success' || needs.fetch_and_push_file.result == 'success' ||(needs.Update_Requests.result == 'success' && needs.Update_Requests.outputs.changes_detected == 'true' )||inputs.run_build_pages == true) && !failure()}} | |
| permissions: | |
| pages: write # Required to deploy to GitHub Pages | |
| id-token: write # Required to deploy to GitHub Pages | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{vars.PAGES_BRANCH}} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| - run: pip install -r .github/workflows/requirements.txt | |
| - name: Execute Python Script | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: python .github/workflows/combine_appfilter.py | |
| - name: Move combinded Appfilter | |
| run: | | |
| mv combined_appfilter.json docs/assets/combined_appfilter.json | |
| mv package_map.json docs/assets/package_map.json | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| # Upload docs folder | |
| path: 'docs' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |