Skip to content

Commit

Permalink
CI: Use actions/deploy-pages to deploy (#419)
Browse files Browse the repository at this point in the history
* CI: Use `actions/deploy-pages` to deploy

* CI: Run `build` job on pull requests too

This will attempt to build the site, but deployment only happens from the `main` branch.
  • Loading branch information
Turbo87 committed Jun 21, 2023
1 parent 6ad806f commit 59cb890
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches: [ main ]

pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build_deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -30,11 +32,24 @@ jobs:
- run: npm run build
- run: echo foundation.rust-lang.org > _site/CNAME

- name: deploy
uses: peaceiris/actions-gh-pages@v3
- uses: actions/[email protected]
with:
publish_dir: _site
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: ${{ github.event.head_commit.message }}
path: ./_site

deploy:
if: ${{ github.ref == 'refs/heads/main' }}

needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- id: deployment
uses: actions/[email protected]

0 comments on commit 59cb890

Please sign in to comment.