-
-
Notifications
You must be signed in to change notification settings - Fork 510
57 lines (55 loc) · 1.81 KB
/
pushweb.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
name: Build and Push website
on:
push:
paths:
- 'Xplat/src/main/resources/assets/botania/lang/en_us.json'
- 'web/**'
jobs:
determinator:
runs-on: ubuntu-latest
outputs:
default_branch: ${{ steps.determinate.outputs.default_branch }}
steps:
- id: determinate
env:
GH_TOKEN: ${{ github.token }}
run: |
DEFAULT_BRANCH=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/VazkiiMods/Botania | jq -r .default_branch)
# Add refs/heads/ for easier comparison with github.ref below
echo "default_branch=refs/heads/$DEFAULT_BRANCH" >> "$GITHUB_OUTPUT"
main:
runs-on: ubuntu-latest
needs: determinator
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
web/vendor
key: ${{ hashFiles('web/Gemfile.lock') }}
- name: Install deps
working-directory: web
run: |
sudo apt-get install bundler
bundle install --deployment
- name: Build website
working-directory: web
run: bundle exec jekyll build
- name: Print branch names for debugging
run: |
echo 'Current branch: ${{ github.ref }}'
echo 'Default branch: ${{ needs.determinator.outputs.default_branch }}'
- name: Import ssh keys
if: ${{ github.ref == needs.determinator.outputs.default_branch }}
run: |
umask go=
mkdir -p ~/.ssh
echo '${{ secrets.VIOLET_MOON_WEBSERVER_SSH_KEY }}' > ~/.ssh/id_ed25519
echo '${{ vars.BOTANIAWEB_KNOWN_HOST }}' >> ~/.ssh/known_hosts
- name: Push
if: ${{ github.ref == needs.determinator.outputs.default_branch }}
run: rsync -rl web/_site/ [email protected]:/var/www/botaniamod_net