Skip to content

Commit cc2dc86

Browse files
authored
Merge pull request docker#9583 from crazy-max/docs-workflow
ci: release workflow to open a PR on docs repo with latest changes
2 parents 908a59a + 0a53d93 commit cc2dc86

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
open-pr:
9+
runs-on: ubuntu-latest
10+
steps:
11+
-
12+
name: Checkout docs repo
13+
uses: actions/checkout@v3
14+
with:
15+
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
16+
repository: docker/docker.github.io
17+
ref: master
18+
-
19+
name: Prepare
20+
run: |
21+
rm -rf ./_data/compose-cli/*
22+
-
23+
name: Build
24+
uses: docker/build-push-action@v3
25+
with:
26+
context: ${{ github.server_url }}/${{ github.repository }}.git#${{ github.event.release.name }}
27+
target: docs-reference
28+
outputs: ./_data/compose-cli
29+
-
30+
name: Update compose_version in _config.yml
31+
run: |
32+
sed -i "s|^compose_version\:.*|compose_version\: \"${{ github.event.release.name }}\"|g" _config.yml
33+
cat _config.yml | yq .compose_version
34+
-
35+
name: Commit changes
36+
run: |
37+
git add -A .
38+
-
39+
name: Create PR on docs repo
40+
uses: peter-evans/create-pull-request@923ad837f191474af6b1721408744feb989a4c27 # v4.0.4
41+
with:
42+
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
43+
commit-message: Update Compose reference API to ${{ github.event.release.name }}
44+
signoff: true
45+
branch: dispatch/compose-api-reference-${{ github.event.release.name }}
46+
delete-branch: true
47+
title: Update Compose reference API to ${{ github.event.release.name }}
48+
body: |
49+
Update the Compose reference API documentation to keep in sync with the latest release `${{ github.event.release.name }}`
50+
labels: area/Compose
51+
draft: false

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,9 @@ COPY --from=make-go-mod-tidy /compose-cli/go.sum .
105105
FROM base AS check-go-mod
106106
COPY . .
107107
RUN make -f builder.Makefile check-go-mod
108+
109+
# docs-reference is a target used as remote context to update docs on release
110+
# with latest changes on docker.github.io.
111+
# see open-pr job in .github/workflows/docs.yml for more details
112+
FROM scratch AS docs-reference
113+
COPY docs/reference/*.yaml .

0 commit comments

Comments
 (0)