Fixes to get github workflows running #254
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: ruby/setup-ruby@v1 | |
with: | |
#TODO: bring this back to 2.7 | |
ruby-version: '2.6' | |
#bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2.1.7 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install Gems | |
run: | | |
# use a bundler that supports our ancient ruby | |
gem install bundler -v 2.4.22 | |
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/github-script@v4.0.2 | |
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!" | |
}); |