Add pre-commit #261
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: Testing | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/testing.yaml | |
- Gemfile | |
- Gemfile.lock | |
- config.rb | |
- data/** | |
- helpers/** | |
- source/** | |
issue_comment: | |
types: [created] | |
env: | |
ENV: test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Ruby | |
uses: actions/setup-ruby@v1 | |
with: | |
#TODO: bring this back to 2.7 | |
ruby-version: '2.6' | |
- uses: actions/checkout@v2 | |
- uses: actions/[email protected] | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install Gems | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- run: echo $ENV | |
- name: Attempt to build the static site | |
run: bundle exec middleman build --bail | |
- name: Push the static site to stage | |
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/push') | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_SECRET_ACCESS_KEY }} | |
STAGE_S3_BUCKET: ${{ secrets.STAGE_S3_BUCKET }} | |
run: aws s3 sync build $STAGE_S3_BUCKET/build/ | |
- uses: actions/[email protected] | |
name: comment-on-pr | |
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/push') && ! failure() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "Deployed to stage!" | |
}); |