Merge pull request #770 from gocd/dependabot/npm_and_yarn/hugo-bin-0.… #294
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
# This workflow will build a middleman project with bundle | |
name: Build and Publish | |
on: | |
push: | |
branches: | |
- master | |
# Push events to branches matching refs/heads/release-* | |
- 'release-*' | |
env: | |
RUN_EXTERNAL_CHECKS: true | |
jobs: | |
complete_build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true # would run bundle install | |
- name: Set up NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Run the build | |
run: bundle exec rake complete_build | |
push_to_gh_pages: | |
needs: complete_build | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PASSWORD: "${{ secrets.GITHUB_TOKEN }}" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
- name: Set up NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Set up user in git config | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
- name: Set up upstream and publish to gh pages | |
run: | | |
git remote add upstream 'https://github-actions:${GITHUB_PASSWORD}@github.com/gocd/docs.go.cd' | |
bundle install | |
bundle exec rake publish | |
env: | |
REMOTE_NAME: "upstream" | |
ALLOW_DIRTY: true | |
sync_to_s3: | |
needs: push_to_gh_pages | |
runs-on: ubuntu-latest | |
env: | |
S3_BUCKET: "${{ secrets.S3_BUCKET }}" | |
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true # would run bundle install | |
- name: Set up NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Upload to S3 | |
run: bundle exec rake upload_to_s3 |