mirror of
https://github.com/bitwarden/help
synced 2025-12-16 08:13:28 +00:00
github action to build and deploy
This commit is contained in:
49
.github/workflows/build.yml
vendored
Normal file
49
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Build Website
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '10.x'
|
||||||
|
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: actions/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: 2.6
|
||||||
|
|
||||||
|
- name: Set up Jekyll
|
||||||
|
run: gem install bundler jekyll
|
||||||
|
|
||||||
|
- name: Set up git credentials
|
||||||
|
if: github.event == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git config --global credential.helper store
|
||||||
|
echo "https://${GH_TOKEN}:x-oauth-basic@github.com" >> ~/.git-credentials
|
||||||
|
git config --global user.email "ci@bitwarden.com"
|
||||||
|
git config --global user.name "Bitwarden CI"
|
||||||
|
|
||||||
|
- name: Print environment
|
||||||
|
run: node --version && npm --version && ruby --version && jekyll --version && git --version
|
||||||
|
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
if: github.event != 'push' || (github.event == 'push' && github.ref != 'refs/heads/master')
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Build site and deploy to gh-pages
|
||||||
|
if: github.event == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
run: npm run deploy
|
||||||
Reference in New Issue
Block a user