Skip to content

Commit

Permalink
Store generated files in workflow artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
skrysmanski committed Feb 10, 2024
1 parent a9d4e65 commit e4c2c7a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ jobs:
# IMPORTANT: Fetch the whole history. This is how Hugo determines the (publish) dates for the articles!!!
fetch-depth: 0

# This creates ${{ steps.short-sha.outputs.sha }} to be used below.
# See: https://github.com/marketplace/actions/short-sha
- name: Provide short commit hash to workflow
id: short-sha
uses: benjlevesque/[email protected]

- name: Download node modules
run: npm install
working-directory: themes/devlog-theme/assets
Expand All @@ -88,6 +94,21 @@ jobs:
run: npx pagefind --site "../../../public"
working-directory: themes/devlog-theme/assets

# See: https://github.com/actions/upload-artifact
# NOTE: Artifacts are retained only up to 90 days at the moment. See: https://github.com/orgs/community/discussions/107115
- name: Add generated files to workflow run
uses: actions/upload-artifact@v4
with:
# To make the artifacts easier to differentiate (i.e. when downloading them from different runs),
# we'll add the workflow run number to the name (this is the same number that's also shown in the
# GitHub UI - like 27 for run #27).
#
# NOTE: We also add some context information (like the commit SHA) to the file name to make it easier
# to identify what this artifact represents.
name: 'generated-files-#${{ github.run_number }}-${{ steps.short-sha.outputs.sha }}'
path: ./public/
if-no-files-found: error

# See: https://github.com/marketplace/actions/ftp-deploy
- name: Deploy site
uses: SamKirkland/[email protected]
Expand Down

0 comments on commit e4c2c7a

Please sign in to comment.