-
Notifications
You must be signed in to change notification settings - Fork 27
92 lines (83 loc) · 2.97 KB
/
build_and_publish.yml
File metadata and controls
92 lines (83 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 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-*'
permissions:
id-token: write
contents: write
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
RUN_EXTERNAL_CHECKS: true
jobs:
complete_build:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ruby
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
with:
bundler-cache: true # would run bundle install
- name: Run the build
run: bundle exec middleman build
push_to_gh_pages:
needs: complete_build
runs-on: ubuntu-latest
env:
GITHUB_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
with:
bundler-cache: true # would run bundle install
- name: Set up user in git config
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
- name: Set up upstream and publish to gh pages
run: |
git remote add upstream 'https://github-actions:${GITHUB_PASSWORD}@github.com/gocd/plugin-api.go.cd'
bundle exec rake publish --trace
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 }}"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
with:
bundler-cache: true # would run bundle install
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: "${{ secrets.AWS_ROLE_TO_ASSUME }}"
aws-region: "${{ secrets.AWS_REGION }}"
- name: Upload to S3
run: bundle exec rake upload_to_s3