Skip to content

Commit

Permalink
fix: add workaround for local artifact issue
Browse files Browse the repository at this point in the history
- Issue: nektos/act#329
- Discussion: nektos/act#2135
  • Loading branch information
kholisrag committed Feb 3, 2024
1 parent 8bbf705 commit 0898c4f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
steps:
- name: Install SOPS
run: |
curl -LO https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64
curl -sLO https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64
mv sops-v${SOPS_VERSION}.linux.amd64 /usr/local/bin/sops
chmod +x /usr/local/bin/sops
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
curl -sL -o ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
if: ${{ !env.ACT }}
run: sudo snap install dart-sass
Expand All @@ -65,10 +65,19 @@ jobs:
HUGO_ENV: production
run: |
make render BASE_URL="${{ steps.pages.outputs.base_url }}"
- name: Upload artifact
- name: Upload Github Artifact
if: ${{ !env.ACT }}
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# Workaround for https://github.com/nektos/act/issues/329
# Discussed in https://github.com/nektos/act/issues/2135
- name: Upload Local Artifact
if: ${{ env.ACT }}
uses: actions/upload-pages-artifact@v2
with:
name: public
path: ./public

# Deployment job
deploy:
Expand Down
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ BASE_URL = $(shell cat CNAME | sed 's/^/https:\/\//' | sed 's/$$/\//')
.PHONY: decrypt local render

check:
@echo "Checking for `sops` command"
@command -v sops >/dev/null 2>&1 || (echo "`sops` not found" && exit 1)
@echo "Checking for `hugo` command"
@command -v hugo >/dev/null 2>&1 || (echo "`hugo` not found" && exit 1)
@echo "Checking for sops command"
@command -v sops >/dev/null 2>&1 || (echo "sops not found" && exit 1)
@echo "Checking for hugo command"
@command -v hugo >/dev/null 2>&1 || (echo "hugo not found" && exit 1)

decrypt:
@echo "Checking for secrets.enc.cfg file"
Expand All @@ -30,7 +30,17 @@ render: decrypt
--baseURL "$(BASE_URL)"

watch-latest-actions:
@echo "Checking for `gh` command"
@command -v gh >/dev/null 2>&1 || (echo "`gh` not found" && exit 1)
@echo "Checking for gh command"
@command -v gh >/dev/null 2>&1 || (echo "gh not found" && exit 1)
@echo "Watching latest actions"
@gh run watch

act:
@echo "Checking for act command"
@command -v act >/dev/null 2>&1 || (echo "act not found" && exit 1)
@echo "Checking for .actrc file"
@ [ -f .actrc ] && (echo ".actrc found") || (echo ".actrc not found")
@echo "Create Local Artifact Directory..."
@mkdir -p ./temp/artifacts
@echo "Running act..."
@act

0 comments on commit 0898c4f

Please sign in to comment.