-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (79 loc) · 2.27 KB
/
test_and_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test and push to wiki
on:
push:
branches:
- main
- prettier
workflow_dispatch:
inputs:
deploy:
description: "Push to main wiki"
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
prettier:
name: Validate formatting with prettier
strategy:
fail-fast: true
continue-on-error: false
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Prettify code
uses: creyD/[email protected]
with:
dry: ${{ github.ref_name != github.event.repository.default_branch }}
push_options: -f
prettier_options: --write **/*.{js,md}
deploy:
name: Deploy to wikis
strategy:
fail-fast: true
continue-on-error: false
needs: prettier
runs-on: ubuntu-22.04
env:
WIKIDIR: ./upstream
if: github.ref_name == github.event.repository.default_branch
steps:
- name: Checkout Upstream
uses: actions/checkout@v3
with:
repository: SickChill/sickchill.wiki
token: ${{ secrets.SICKCHILL_TOK }}
path: ${{ env.WIKIDIR }}
ref: master
fetch-depth: 0
- name: Get changes from wikitemp
run: |
git remote add wikitemp https://github.com/SickChill/SickChill.WikiTemp.git
git fetch wikitemp
git reset --hard wikitemp/${{ github.ref_name }}
working-directory: ${{ env.WIKIDIR }}
- name: Push changes to temp wiki
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
repository: SickChill/SickChill.WikiTemp.wiki
force: true
directory: ${{ env.WIKIDIR }}
branch: master
- name: Push changes to main wiki
if: ${{ github.event.inputs.deploy }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SICKCHILL_TOK }}
repository: SickChill/sickchill.wiki
force: true
directory: ${{ env.WIKIDIR }}
branch: master