Skip to content

Merge pull request #821 from gocd/dependabot/npm_and_yarn/hugo-bin-0.… #358

Merge pull request #821 from gocd/dependabot/npm_and_yarn/hugo-bin-0.…

Merge pull request #821 from gocd/dependabot/npm_and_yarn/hugo-bin-0.… #358

# 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@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true # would run bundle install
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
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@v4
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
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@v4
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true # would run bundle install
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Upload to S3
run: bundle exec rake upload_to_s3