mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-08 19:34:56 +02:00
pipeline
This commit is contained in:
83
.github/workflows/deploy.yml
vendored
83
.github/workflows/deploy.yml
vendored
@@ -1,52 +1,49 @@
|
|||||||
# .github/workflows/deploy.yml
|
name: Deploy to GitHub Pages
|
||||||
|
|
||||||
name: GitHub Pages
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- '.github/workflows/deploy.yml'
|
|
||||||
- 'documents/**'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
test-deploy:
|
||||||
runs-on: ubuntu-22.04
|
if: github.event_name != 'push'
|
||||||
permissions:
|
runs-on: ubuntu-latest
|
||||||
contents: write
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: /
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
- name: Get yarn cache
|
|
||||||
id: yarn-cache
|
|
||||||
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> "${GITHUB_OUTPUT}"
|
|
||||||
|
|
||||||
- name: Cache dependencies
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache.outputs.YARN_CACHE_DIR }}
|
node-version: 18
|
||||||
key: ${{ runner.os }}-documents-${{ hashFiles('**/yarn.lock') }}
|
cache: yarn
|
||||||
restore-keys: |
|
- name: Install dependencies
|
||||||
${{ runner.os }}-documents-
|
run: yarn install --frozen-lockfile
|
||||||
|
- name: Test build website
|
||||||
- run: yarn install --frozen-lockfile
|
run: yarn build
|
||||||
- run: yarn build
|
deploy:
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
- name: Deploy
|
runs-on: ubuntu-latest
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
steps:
|
||||||
if: github.ref == 'refs/heads/master'
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
fetch-depth: 0
|
||||||
publish_dir: ./documents/build
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: yarn
|
||||||
|
- uses: webfactory/ssh-agent@v0.5.0
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
env:
|
||||||
|
USE_SSH: true
|
||||||
|
run: |
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
git config --global user.name "gh-actions"
|
||||||
|
yarn install --frozen-lockfile
|
||||||
|
yarn deploy
|
26
.github/workflows/test-deploy.yml
vendored
Normal file
26
.github/workflows/test-deploy.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Test deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
# Review gh actions docs if you want to further define triggers, paths, etc
|
||||||
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-deploy:
|
||||||
|
name: Test deployment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: yarn
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
- name: Test build documents
|
||||||
|
run: yarn build
|
Reference in New Issue
Block a user