Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f980b9b

Browse files
committedMay 3, 2025·
add example upload worklfow
1 parent f6f80c4 commit f980b9b

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
 

‎.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: SpechtLabs Static-Pages deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
id-token: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Git checkout
16+
uses: actions/checkout@v3
17+
with:
18+
submodules: recursive # fetch Hugo themes
19+
fetch-depth: 0
20+
21+
- name: Init submodules
22+
run: git submodule update --init --recursive
23+
24+
- uses: actions/cache@v3
25+
with:
26+
path: /tmp/hugo_cache
27+
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-hugomod-
30+
31+
- name: Setup hugo
32+
uses: peaceiris/actions-hugo@v2
33+
with:
34+
hugo-version: "latest"
35+
extended: true
36+
37+
- name: Build
38+
# remove --minify tag if you do not need it
39+
# docs: https://gohugo.io/hugo-pipes/minification/
40+
run: hugo --minify
41+
42+
- name: Upload static site artifacts
43+
shell: bash
44+
run: |
45+
# Fetch GitHub OIDC token
46+
TOKEN=$(curl -sSfL -X POST \
47+
-H "Authorization: bearer $ACTIONS_RUNTIME_TOKEN" \
48+
-H "Accept: application/json; api-version=2.0" \
49+
"https://github.com/api/actions/oidc/token?audience=your-api" \
50+
| jq -r '.value')
51+
52+
# Prepare curl arguments
53+
CURL_ARGS=()
54+
for file in dist/*; do
55+
[ -f "$file" ] || continue
56+
CURL_ARGS+=("-F" "files[]=@${file}")
57+
done
58+
59+
# Upload to your REST API
60+
curl -X POST https://static-pages.sphinx-map.ts.net/upload \
61+
-H "Authorization: Bearer $TOKEN" \
62+
"${CURL_ARGS[@]}"

0 commit comments

Comments
 (0)
Please sign in to comment.