-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (100 loc) · 3.36 KB
/
Copy pathdeploy.yml
File metadata and controls
115 lines (100 loc) · 3.36 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Deploy
on:
push:
branches:
- master
- source
pull_request:
branches:
- master
- source
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Install dependencies
run: |
gem install bundler
bundle config set path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Setup deploy options
id: setup
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ "${GITHUB_REF}" == refs/pull/*/merge ]]; then
echo "SRC_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_OUTPUT
echo "NO_PUSH=--no-push" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF}" == refs/heads/* ]]; then
echo "SRC_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
fi
if [[ "${{ github.repository }}" == *.github.io ]]; then
echo "DEPLOY_BRANCH=master" >> $GITHUB_OUTPUT
else
echo "DEPLOY_BRANCH=gh-pages" >> $GITHUB_OUTPUT
fi
- name: Deploy website
run: |
yes | bin/deploy --verbose ${{ steps.setup.outputs.NO_PUSH }} \
--src ${{ steps.setup.outputs.SRC_BRANCH }} \
--deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }}
# name: Deploy
# on:
# push:
# branches:
# - master
# - source
# pull_request:
# branches:
# - master
# - source
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Setup Ruby
# uses: actions/setup-ruby@v1
# with:
# ruby-version: '3.2'
# bundler-cache: true
# - name: Enable bundler cache
# uses: actions/cache@v3
# with:
# path: vendor/bundle
# key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-gems-
# - name: Install deps
# run: |
# gem install bundler
# bundle config path vendor/bundle
# bundle install --jobs 4 --retry 3
# - name: Setup deploy options
# id: setup
# run: |
# git config --global user.name "GitHub Action"
# git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# if [[ ${GITHUB_REF} = refs/pull/*/merge ]]; then # pull request
# echo "::set-output name=SRC_BRANCH::${GITHUB_HEAD_REF}"
# echo "::set-output name=NO_PUSH::--no-push"
# elif [[ ${GITHUB_REF} = refs/heads/* ]]; then # branch, e.g. master, source etc
# echo "::set-output name=SRC_BRANCH::${GITHUB_REF#refs/heads/}"
# fi
# if [[ ${{ github.repository }} = *.github.io ]]; then # user/org repo
# echo "::set-output name=DEPLOY_BRANCH::master"
# else
# echo "::set-output name=DEPLOY_BRANCH::gh-pages"
# fi
# - name: Deploy website
# run: yes | bin/deploy --verbose ${{ steps.setup.outputs.NO_PUSH }}
# --src ${{ steps.setup.outputs.SRC_BRANCH }}
# --deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }}