Skip to content

Commit c843336

Browse files
committed
Merge branch 'main' of https://github.com/Wolfyxon/SongWrap
2 parents d654f8d + 093b963 commit c843336

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Deploy Svelte to Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Detect package manager
25+
id: detect-package-manager
26+
run: |
27+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
28+
echo "manager=yarn" >> $GITHUB_OUTPUT
29+
echo "command=install" >> $GITHUB_OUTPUT
30+
echo "runner=yarn" >> $GITHUB_OUTPUT
31+
exit 0
32+
elif [ -f "${{ github.workspace }}/package.json" ]; then
33+
echo "manager=npm" >> $GITHUB_OUTPUT
34+
echo "command=ci" >> $GITHUB_OUTPUT
35+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
36+
exit 0
37+
else
38+
echo "Unable to determine package manager"
39+
exit 1
40+
fi
41+
42+
- name: Setup Node
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: "lts/*"
46+
cache: ${{ steps.detect-package-manager.outputs.manager }}
47+
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v4
50+
51+
- name: Restore cache
52+
uses: actions/cache@v4
53+
with:
54+
path: |
55+
.next/cache
56+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
57+
restore-keys: |
58+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
59+
60+
- name: Install dependencies
61+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
62+
63+
- name: Build
64+
run: ${{ steps.detect-package-manager.outputs.runner }} vite build
65+
66+
- name: Upload artifact
67+
uses: actions/upload-pages-artifact@v3
68+
with:
69+
path: ./build
70+
deploy:
71+
environment:
72+
name: github-pages
73+
url: ${{ steps.deployment.outputs.page_url }}
74+
runs-on: ubuntu-latest
75+
needs: build
76+
steps:
77+
- name: Deploy to GitHub Pages
78+
id: deployment
79+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)