-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from skrysmanski/feature/store-build-artifacts
Store generated files an workflow artifacts
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -88,6 +94,30 @@ jobs: | |
run: npx pagefind --site "../../../public" | ||
working-directory: themes/devlog-theme/assets | ||
|
||
- name: Determine Hugo version | ||
id: hugo-version | ||
run: hugo version | sed -r 's/hugo v([0-9.]+).*/version=\1/' >> $GITHUB_OUTPUT | ||
|
||
# | ||
# Store generated files in a zip file in the workflow itself. This way outputs between two workflow runs can be compared, | ||
# if necessary. | ||
# | ||
# NOTE: Artifacts are retained only up to 90 days at the moment. See: https://github.com/orgs/community/discussions/107115 | ||
# | ||
# See: https://github.com/actions/upload-artifact | ||
- 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 }}_sha-${{ steps.short-sha.outputs.sha }}_hugo-${{ steps.hugo-version.outputs.version }}' | ||
path: ./public/ | ||
if-no-files-found: error | ||
|
||
# See: https://github.com/marketplace/actions/ftp-deploy | ||
- name: Deploy site | ||
uses: SamKirkland/[email protected] | ||
|