tangled
alpha
login
or
join now
akshitgaur2005.tngl.sh
/
himwant
0
fork
atom
Musings from the mountains
himwant.org
0
fork
atom
overview
issues
pulls
pipelines
Some musings...
akshitgaur2005.tngl.sh
4 months ago
9312b1ec
c262ef4a
+90
1 changed file
expand all
collapse all
unified
split
.github
workflows
astro.yml
+90
.github/workflows/astro.yml
···
1
1
+
# Sample workflow for building and deploying an Astro site to GitHub Pages
2
2
+
#
3
3
+
# To get started with Astro see: https://docs.astro.build/en/getting-started/
4
4
+
#
5
5
+
name: Deploy Astro site to Pages
6
6
+
7
7
+
on:
8
8
+
# Runs on pushes targeting the default branch
9
9
+
push:
10
10
+
branches: ["main"]
11
11
+
12
12
+
# Allows you to run this workflow manually from the Actions tab
13
13
+
workflow_dispatch:
14
14
+
15
15
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16
16
+
permissions:
17
17
+
contents: read
18
18
+
pages: write
19
19
+
id-token: write
20
20
+
21
21
+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22
22
+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23
23
+
concurrency:
24
24
+
group: "pages"
25
25
+
cancel-in-progress: false
26
26
+
27
27
+
env:
28
28
+
BUILD_PATH: "." # default value when not using subfolders
29
29
+
# BUILD_PATH: subfolder
30
30
+
31
31
+
jobs:
32
32
+
build:
33
33
+
name: Build
34
34
+
runs-on: ubuntu-latest
35
35
+
steps:
36
36
+
- name: Checkout
37
37
+
uses: actions/checkout@v4
38
38
+
- name: Detect package manager
39
39
+
id: detect-package-manager
40
40
+
run: |
41
41
+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
42
42
+
echo "manager=yarn" >> $GITHUB_OUTPUT
43
43
+
echo "command=install" >> $GITHUB_OUTPUT
44
44
+
echo "runner=yarn" >> $GITHUB_OUTPUT
45
45
+
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
46
46
+
exit 0
47
47
+
elif [ -f "${{ github.workspace }}/package.json" ]; then
48
48
+
echo "manager=npm" >> $GITHUB_OUTPUT
49
49
+
echo "command=ci" >> $GITHUB_OUTPUT
50
50
+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
51
51
+
echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT
52
52
+
exit 0
53
53
+
else
54
54
+
echo "Unable to determine package manager"
55
55
+
exit 1
56
56
+
fi
57
57
+
- name: Setup Node
58
58
+
uses: actions/setup-node@v4
59
59
+
with:
60
60
+
node-version: "20"
61
61
+
cache: ${{ steps.detect-package-manager.outputs.manager }}
62
62
+
cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }}
63
63
+
- name: Setup Pages
64
64
+
id: pages
65
65
+
uses: actions/configure-pages@v5
66
66
+
- name: Install dependencies
67
67
+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
68
68
+
working-directory: ${{ env.BUILD_PATH }}
69
69
+
- name: Build with Astro
70
70
+
run: |
71
71
+
${{ steps.detect-package-manager.outputs.runner }} astro build \
72
72
+
--site "${{ steps.pages.outputs.origin }}" \
73
73
+
--base "${{ steps.pages.outputs.base_path }}"
74
74
+
working-directory: ${{ env.BUILD_PATH }}
75
75
+
- name: Upload artifact
76
76
+
uses: actions/upload-pages-artifact@v3
77
77
+
with:
78
78
+
path: ${{ env.BUILD_PATH }}/dist
79
79
+
80
80
+
deploy:
81
81
+
environment:
82
82
+
name: github-pages
83
83
+
url: ${{ steps.deployment.outputs.page_url }}
84
84
+
needs: build
85
85
+
runs-on: ubuntu-latest
86
86
+
name: Deploy
87
87
+
steps:
88
88
+
- name: Deploy to GitHub Pages
89
89
+
id: deployment
90
90
+
uses: actions/deploy-pages@v4