Skip to content

Commit 9e9244b

Browse files
committed
ci(github-actions): deploy to GitHub Pages on release
- Update GitHub Actions workflow to trigger on release publication - Remove staging deployment steps - Simplify configuration for production deployment - Update site URL and base path in astro.config.mjs
1 parent 080381c commit 9e9244b

File tree

2 files changed

+15
-37
lines changed

2 files changed

+15
-37
lines changed

.github/workflows/deploy.yml

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy to GitHub Pages on Release
22

33
on:
4-
push:
5-
branches:
6-
- main
74
release:
85
types: [published]
96

7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
1012
jobs:
11-
build:
13+
deploy:
1214
runs-on: ubuntu-latest
15+
1316
steps:
1417
- name: Checkout
1518
uses: actions/checkout@v4
@@ -26,37 +29,14 @@ jobs:
2629
- name: Build
2730
run: npm run build
2831

32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
2935
- name: Upload artifact
3036
uses: actions/upload-pages-artifact@v3
3137
with:
3238
path: ./dist
3339

34-
deploy-staging:
35-
needs: build
36-
if: github.event_name == 'push'
37-
runs-on: ubuntu-latest
38-
permissions:
39-
pages: write
40-
id-token: write
41-
environment:
42-
name: github-pages
43-
url: ${{ steps.deployment.outputs.page_url }}
44-
steps:
45-
- name: Deploy to GitHub Pages
46-
id: deployment
47-
uses: actions/deploy-pages@v4
48-
49-
deploy-production:
50-
needs: build
51-
if: github.event_name == 'release'
52-
runs-on: ubuntu-latest
53-
permissions:
54-
pages: write
55-
id-token: write
56-
environment:
57-
name: github-pages
58-
url: ${{ steps.deployment.outputs.page_url }}
59-
steps:
6040
- name: Deploy to GitHub Pages
6141
id: deployment
62-
uses: actions/deploy-pages@v4
42+
uses: actions/deploy-pages@v4

astro.config.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import starlight from '@astrojs/starlight';
44

55
// https://astro.build/config
66
export default defineConfig({
7-
site: process.env.CI
8-
? 'https://flutter-news-app-full-source-code.github.io'
9-
: 'http://localhost:4321',
10-
base: process.env.CI ? (process.env.GITHUB_EVENT_NAME === 'release' ? '/docs' : '/docs-staging') : '/',
7+
site: 'https://flutter-news-app-full-source-code.github.io',
8+
base: '/docs',
119
integrations: [
1210
starlight({
1311
title: 'Flutter News App Toolkit',
@@ -104,4 +102,4 @@ export default defineConfig({
104102
],
105103
}),
106104
],
107-
});
105+
});

0 commit comments

Comments
 (0)