-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github action: add deploy workflow (#163)
* Github action: add deploy workflow * Update .github/workflows/deploy.yml Co-authored-by: Maruan <[email protected]>
- Loading branch information
1 parent
0369fe3
commit 625fb69
Showing
2 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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 | ||
- name: Enable bundler cache | ||
uses: actions/cache@v2 | ||
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=DRY_RUN::--dry-run" | ||
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.DRY_RUN }} | ||
--src ${{ steps.setup.outputs.SRC_BRANCH }} | ||
--deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters