Skip to content

Commit d3b780a

Browse files
authored
Merge pull request #868 from ehuss/deploy-gh-pages
Use actions/deploy-pages to deploy the website
2 parents 01c3819 + 3c4612d commit d3b780a

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,44 @@ on:
88
- master
99

1010
jobs:
11-
ci:
12-
name: CI
13-
runs-on: ubuntu-latest
11+
build:
1412
env:
1513
MDBOOK_VERSION: 0.4.51
16-
permissions:
17-
id-token: write
18-
contents: write
14+
runs-on: ubuntu-latest
1915
steps:
20-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
2117
- name: Install mdbook
2218
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz
2319
- name: Check blacksmith format
2420
run: cargo fmt --check --manifest-path=blacksmith/Cargo.toml
2521
- name: Build book
2622
run: ./mdbook build
27-
- name: Deploy book
28-
uses: rust-lang/simpleinfra/github-actions/static-websites@master
29-
with:
30-
deploy_dir: book
31-
github_token: "${{ secrets.GITHUB_TOKEN }}"
23+
- name: Upload artifact
3224
if: github.ref == 'refs/heads/master'
25+
uses: actions/upload-pages-artifact@v3
26+
with:
27+
path: ./book
28+
29+
deploy:
30+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'rust-lang'
31+
needs: build
32+
33+
permissions:
34+
pages: write
35+
id-token: write
36+
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
41+
runs-on: ubuntu-latest
42+
steps:
43+
- id: deployment
44+
uses: actions/deploy-pages@4
3345
- name: Configure AWS credentials
34-
if: github.ref == 'refs/heads/master'
3546
uses: aws-actions/configure-aws-credentials@v1
3647
with:
3748
role-to-assume: arn:aws:iam::890664054962:role/forge-rust-lang-org-ci
3849
aws-region: us-east-1
3950
- name: Invalidate CloudFront cache
4051
run: aws cloudfront create-invalidation --distribution-id E12A3GKHZSREHP --paths "/*"
41-
if: github.ref == 'refs/heads/master'

0 commit comments

Comments
 (0)