Merge pull request #2449 from Kaiserdragon2/Pages #1281
This file contains 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: Combine Appfilter and Build Pages | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
paths: | |
- 'newicons/appfilter.xml' | |
push: | |
branches: ["Arcticons-Pages"] | |
workflow_run: | |
workflows: [Update Requests] | |
types: | |
- completed | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
pull-requests: write # Required to comment on PRs | |
jobs: | |
parse_appfilter: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request_target' | |
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@v4 | |
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 "Parsing of 'newicons/appfilter.xml' failed. Please fix the XML syntax errors. \n \`\`\` \n $PARSE_OUTPUT \n \`\`\`" >> comment_markdown.md | |
exit 1 | |
else | |
echo "Parsing succeeded." | |
fi | |
- name: Post failure comment to PR | |
if: failure() | |
run: | | |
gh pr comment ${{ github.event.pull_request.number }} --body-file comment_markdown.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
parse_and_combine: | |
needs: parse_appfilter | |
if: '!failure()' | |
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@v4 | |
with: | |
ref: Arcticons-Pages | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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.xml docs/assets/combined_appfilter.xml | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload docs folder | |
path: 'docs' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |