Skip to content

Commit c9e7e91

Browse files
athomasCommit Queue
authored andcommitted
Add a GH action to publish the docker libary
Closes #244 GitOrigin-RevId: 56f187e Change-Id: I8492a1ae6343e836ed0e490ac17e7cd48d1cf380 Reviewed-on: https://dart-review.googlesource.com/c/dart-docker/+/449200 Commit-Queue: Alexander Thomas <[email protected]> Reviewed-by: Ivan Inozemtsev <[email protected]>
1 parent 1dfd9d9 commit c9e7e91

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish Docker Library
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'beta/**'
8+
- 'stable/**'
9+
10+
jobs:
11+
publish-library:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
15+
- name: Set up Dart
16+
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
17+
- name: Install dependencies
18+
run: dart pub get
19+
working-directory: scripts
20+
- name: Generate library file
21+
id: generate
22+
run: |
23+
dart scripts/bin/generate_library.dart > dart
24+
echo "library_path=dart" >> $GITHUB_OUTPUT
25+
- name: Create Pull Request
26+
env:
27+
GH_TOKEN: ${{ secrets.PUBLISH_LIBRARY_TOKEN }}
28+
run: |
29+
set -x
30+
git config --global user.name "dart-github-bot"
31+
git config --global user.email "[email protected]"
32+
33+
gh repo fork docker-library/official-images --clone=true --remote
34+
cd official-images
35+
36+
git fetch upstream
37+
38+
git checkout -B dart-library-update upstream/master
39+
40+
cp ../${{ steps.generate.outputs.library_path }} library/dart
41+
42+
git add library/dart
43+
git commit -m "Update dart"
44+
45+
git push --force --set-upstream origin dart-library-update
46+
47+
if ! gh pr list --repo docker-library/official-images --head "dart-github-bot:dart-library-update" --json number | grep -q number; then
48+
BODY=$(cat <<EOF
49+
This is an automated PR to update the Dart Docker library.
50+
51+
cc @iinozemtsev @athom
52+
EOF
53+
)
54+
gh pr create \
55+
--title "Update dart" \
56+
--body "$BODY" \
57+
--repo docker-library/official-images \
58+
--base master \
59+
--head "dart-github-bot:dart-library-update"
60+
fi

0 commit comments

Comments
 (0)