change ruby version #298
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
name: deploy | |
on: | |
push: | |
branches: | |
- master | |
- main | |
pull_request: | |
branches: | |
- master | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Install Ruby manually since it cannot be installed automatically | |
- name: Install Ruby | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y git curl libssl-dev zlib1g-dev | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
source ~/.bashrc | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
~/.rbenv/bin/rbenv install 3.2.2 | |
~/.rbenv/bin/rbenv global 3.2.2 | |
# Verify Ruby installation | |
- name: Check Ruby Version | |
run: ruby --version | |
# - name: Setup Ruby | |
# uses: ruby/setup-ruby@v1 | |
# with: | |
# ruby-version: '3.2' | |
- name: Install Bundler | |
run: gem install bundler:2.5.11 | |
- name: Install deps | |
run: | | |
npm install -g mermaid.cli | |
bundle install --verbose | |
- name: Build site | |
run: bundle exec jekyll build | |
- 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 | |
echo "::set-output name=DEPLOY_BRANCH::gh-pages" | |
- name: Commit changes to Gemfile.lock | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add Gemfile.lock | |
git commit -m "Automated commit of Gemfile.lock changes" || echo "No changes to commit" | |
git pull | |
git push origin main | |
- name: Deploy website | |
run: yes | bash bin/deploy --verbose ${{ steps.setup.outputs.NO_PUSH }} | |
--src ${{ steps.setup.outputs.SRC_BRANCH }} | |
--deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }} |