Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move file generation from deployment to build #74

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,52 @@ jobs:
- name: "Tidy the HTML"
run: find . -name '*.html' | xargs tidy -indent --wrap 0 --output-html yes --warn-proprietary-attributes no -quiet -modify

- name: "Generate a security.txt file"
run: |
tee security.txt << EOF
Contact: ${{ steps.configure-pages.outputs.base_url }}/contact
Policy: ${{ steps.configure-pages.outputs.base_url }}/security/policy
Acknowledgments: ${{ steps.configure-pages.outputs.base_url }}/humans.txt
Canonical: ${{ steps.configure-pages.outputs.base_url }}/security.txt
Expires: $(date -u +"%Y-12-31T23:59:59.999Z")
EOF

- name: "Generate a humans.txt file"
run: gh api "${ENDPOINT}" --template "${TEMPLATE}" | sh | tee humans.txt
env:
ENDPOINT: '/orgs/${{ github.repository_owner }}/repos'
TEMPLATE: |
echo "# Contributors by Repository"
echo
echo "A huge thanks to all and colaborators who have contributed on GitHub!"
echo
{{range .}}
echo "## {{.full_name}}"
echo
gh api '/repos/{{.full_name}}/contributors' --jq '.[].login' | sort -u | xargs -ILOGIN gh api '/users/LOGIN' --jq '"- @" + .login + " (" + (.name // .login) + ")"'
echo
{{end}}

- name: "Generate a robots.txt file"
run: |
tee robots.txt << EOF
Sitemap: ${{ steps.configure-pages.outputs.base_url }}/sitemap.txt
EOF

- name: "Generate a version.txt file"
run: |
tee version.txt << EOF
Deployed: $(date --universal +'%FT%TZ')
Version: v0.0.${{ github.run_number }}.$((${{ github.run_attempt }} - 1))
Source: ${{ github.server_url }}/${{ github.repository }}/tree/$(echo "${{ github.sha }}" | head -c 7)
EOF

- name: "Generate a sitemap.txt file"
env: { BASE_URL: '${{ steps.configure-pages.outputs.base_url }}' }
run: |
touch sitemap.txt # this ensures that the sitemap detects itself
find . -type f -printf "${BASE_URL}/%P\n" | sed -e 's/\(\.html\)*$//g' | sort --unique | tee -a sitemap.txt

- name: "Archive Pages Artifact"
uses: actions/upload-artifact@v4
with:
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,52 +48,6 @@ jobs:
with:
name: pages

- name: "Generate a security.txt file"
run: |
tee security.txt << EOF
Contact: ${{ steps.configure-pages.outputs.base_url }}/contact
Policy: ${{ steps.configure-pages.outputs.base_url }}/security/policy
Acknowledgments: ${{ steps.configure-pages.outputs.base_url }}/humans.txt
Canonical: ${{ steps.configure-pages.outputs.base_url }}/security.txt
Expires: $(date -u +"%Y-12-31T23:59:59.999Z")
EOF

- name: "Generate a humans.txt file"
run: gh api "${ENDPOINT}" --template "${TEMPLATE}" | sh | tee humans.txt
env:
ENDPOINT: '/orgs/${{ github.repository_owner }}/repos'
TEMPLATE: |
echo "# Contributors by Repository"
echo
echo "A huge thanks to all and colaborators who have contributed on GitHub!"
echo
{{range .}}
echo "## {{.full_name}}"
echo
gh api '/repos/{{.full_name}}/contributors' --jq '.[].login' | sort -u | xargs -ILOGIN gh api '/users/LOGIN' --jq '"- @" + .login + " (" + (.name // .login) + ")"'
echo
{{end}}

- name: "Generate a robots.txt file"
run: |
tee robots.txt << EOF
Sitemap: ${{ steps.configure-pages.outputs.base_url }}/sitemap.txt
EOF

- name: "Generate a version.txt file"
run: |
tee version.txt << EOF
Deployed: $(date --universal +'%FT%TZ')
Version: v0.0.${{ github.run_number }}.$((${{ github.run_attempt }} - 1))
Source: ${{ github.server_url }}/${{ github.repository }}/tree/$(echo "${{ github.sha }}" | head -c 7)
EOF

- name: "Generate a sitemap.txt file"
env: { BASE_URL: '${{ steps.configure-pages.outputs.base_url }}' }
run: |
touch sitemap.txt # this ensures that the sitemap detects itself
find . -type f -printf "${BASE_URL}/%P\n" | sed -e 's/\(\.html\)*$//g' | sort --unique | tee -a sitemap.txt

- name: "Create a Pages Artifact"
uses: actions/upload-pages-artifact@v3
with:
Expand Down