Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4b56bf4

Browse files
authored
Merge pull request #3 from flutter-news-app-full-source-code/ci_github_pages
Ci GitHub pages
2 parents dab1f43 + 67c988b commit 4b56bf4

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

‎.github/workflows/deploy.yml‎

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

33
on:
4+
push:
5+
branches:
6+
- main
47
release:
58
types: [published]
69

7-
permissions:
8-
contents: read
9-
pages: write
10-
id-token: write
11-
1210
jobs:
13-
deploy:
11+
build:
1412
runs-on: ubuntu-latest
15-
1613
steps:
1714
- name: Checkout
1815
uses: actions/checkout@v4
@@ -29,14 +26,37 @@ jobs:
2926
- name: Build
3027
run: npm run build
3128

32-
- name: Setup Pages
33-
uses: actions/configure-pages@v5
34-
3529
- name: Upload artifact
3630
uses: actions/upload-pages-artifact@v3
3731
with:
3832
path: ./dist
3933

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:
4060
- name: Deploy to GitHub Pages
4161
id: deployment
4262
uses: actions/deploy-pages@v4

‎astro.config.mjs‎

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

55
// https://astro.build/config
66
export default defineConfig({
7-
site: 'https://flutter-news-app-full-source-code.github.io',
8-
base: '/docs',
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') : '/',
911
integrations: [
1012
starlight({
1113
title: 'Flutter News App Toolkit',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /