Skip to content

Commit 73600f8

Browse files
committed
Update Github action.
1 parent 0a7db68 commit 73600f8

File tree

1 file changed

+14
-68
lines changed

1 file changed

+14
-68
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,91 +2,37 @@ name: deploy
22

33
on:
44
push:
5-
branches:
5+
branches:
66
- master
7-
8-
# Allows you to run this workflow manually from the Actions tab
7+
# Allows you to run this workflow manually from the Actions tab on Github.
98
workflow_dispatch:
109

10+
# Allow this job to clone the repo and create a page deployment
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
1116
# Allow one concurrent deployment
1217
concurrency:
1318
group: "pages"
1419
cancel-in-progress: true
1520

16-
defaults:
17-
run:
18-
shell: bash
19-
2021
jobs:
2122
build:
2223
runs-on: ubuntu-latest
23-
2424
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26-
- uses: actions/checkout@v3
27-
28-
- name: Detect package manager
29-
id: detect-package-manager
30-
run: |
31-
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
32-
echo "::set-output name=manager::yarn"
33-
echo "::set-output name=command::install"
34-
echo "::set-output name=runner::yarn"
35-
exit 0
36-
elif [ -f "${{ github.workspace }}/package.json" ]; then
37-
echo "::set-output name=manager::npm"
38-
echo "::set-output name=command::ci"
39-
echo "::set-output name=runner::npx --no-install"
40-
exit 0
41-
else
42-
echo "Unable to determine packager manager"
43-
exit 1
44-
fi
45-
46-
- name: Setup Node
47-
uses: actions/setup-node@v3
48-
with:
49-
node-version: "18"
50-
cache: ${{ steps.detect-package-manager.outputs.manager }}
51-
52-
- name: Restore cache
53-
uses: actions/cache@v3
54-
with:
55-
path: |
56-
dist
57-
.vercel
58-
key: ${{ runner.os }}-vercel-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.astro', '**.[jt]s', '**.[jt]sx') }}
59-
restore-keys: |
60-
${{ runner.os }}-vercel-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
61-
62-
- name: Install dependencies
63-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
64-
65-
- name: Static HTML export with Vercel
66-
run: ${{ steps.detect-package-manager.outputs.manager }} run build
67-
68-
- name: Upload artifact
69-
uses: actions/upload-pages-artifact@v1
70-
with:
71-
path: ./dist
25+
- uses: actions/checkout@v4
26+
- name: Install, build, and upload site
27+
uses: withastro/action@v3
7228

7329
deploy:
74-
# Add a dependency to the build job
7530
needs: build
76-
77-
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
78-
permissions:
79-
pages: write # to deploy to Pages
80-
id-token: write # to verify the deployment originates from an appropriate source
81-
82-
# Deploy to the github-pages environment
31+
runs-on: ubuntu-latest
8332
environment:
8433
name: github-pages
8534
url: ${{ steps.deployment.outputs.page_url }}
86-
87-
runs-on: ubuntu-latest
88-
8935
steps:
90-
- name: Deploy GitHub Pages site
36+
- name: Deploy to GitHub Pages
9137
id: deployment
92-
uses: actions/deploy-pages@v1.2.0
38+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)