-
Notifications
You must be signed in to change notification settings - Fork 2
174 lines (158 loc) · 6.57 KB
/
autobuildall.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: AutoBuildAll
on:
workflow_dispatch:
schedule:
- cron: '42 7 * * *' # At 0742 each day
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
check_for_new_stable:
runs-on: ubuntu-latest
outputs:
dartversion: ${{ steps.dartversion.outputs.dartversion }}
steps:
- name: checkout repo content
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: dartversion
name: Check stable version
run: |
DDURL="https://raw.githubusercontent.com/dart-lang/dart-docker/main/versions.json"
curl -s $DDURL | jq -r .stable.version > DART_STABLE_VERSION
if [ -z "$(git status --porcelain)" ]; then
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo 'No new stable release of Dart'
echo "dartversion=NOTNEW" >> $GITHUB_OUTPUT
exit 0
fi
fi
DART_VERSION=$(cat DART_STABLE_VERSION)
echo "dartversion=${DART_VERSION}" >> $GITHUB_OUTPUT
build_multi_arch_images:
needs: [check_for_new_stable]
if: ${{ needs.check_for_new_stable.outputs.dartversion != 'NOTNEW' }}
env:
DART_VERSION: ${{ needs.check_for_new_stable.outputs.dartversion }}
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Multi Arch buildimage
id: docker_build1
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: ./at-buildimage/Dockerfile
build-args: DART_VERSION=${{ env.DART_VERSION }}
push: true
provenance: false
tags: |
atsigncompany/buildimage:automated
atsigncompany/buildimage:${{ env.DART_VERSION }}
atsigncompany/buildimage:GHA_${{ github.run_number }}
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
- name: Get SDK SHAs
id: sdk_shas
run: |
function get_stable_sha {
curl -s ${SHAPRE}${DART_VERSION}${SHAMID}$1${SHAEND} | awk '{print $1}'
}
SHAPRE="https://storage.googleapis.com/dart-archive/channels/stable/release/"
SHAMID="/sdk/dartsdk-linux-"
SHAEND="-release.zip.sha256sum"
echo "X64_SHA=$(get_stable_sha x64)" >> $GITHUB_ENV
echo "ARM_SHA=$(get_stable_sha arm)" >> $GITHUB_ENV
echo "ARM64_SHA=$(get_stable_sha arm64)" >> $GITHUB_ENV
echo "RISCV64_SHA=$(get_stable_sha riscv64)" >> $GITHUB_ENV
- name: Build and push RISC-V buildimage
id: docker_build2
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: ./at-buildimage/Dockerfile.RV64
build-args: |
DART_VERSION=${{ env.DART_VERSION }}
X64_SHA=${{ env.X64_SHA }}
ARM_SHA=${{ env.ARM_SHA }}
ARM64_SHA=${{ env.ARM64_SHA }}
RISCV64_SHA=${{ env.RISCV64_SHA }}
push: true
provenance: false
tags: |
atsigncompany/buildimage:riscv
atsigncompany/buildimage:riscv-GHA_${{ github.run_number }}
atsigncompany/buildimage:riscv_${{ env.DART_VERSION }}
platforms: |
linux/riscv64
- name: Combine build images
id: docker_manifest_build
run: |
docker buildx imagetools create -t atsigncompany/buildimage:automated \
--append atsigncompany/buildimage:riscv
docker buildx imagetools create -t atsigncompany/buildimage:${{ env.DART_VERSION }} \
--append atsigncompany/buildimage:riscv
docker buildx imagetools create -t atsigncompany/buildimage:GHA_${{ github.run_number }} \
--append atsigncompany/buildimage:riscv
- name: Build and push dartshowplatform
id: docker_build3
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: ./dartshowplatform/Dockerfile
build-args: DART_VERSION=${{ env.DART_VERSION }}
push: true
provenance: false
tags: |
atsigncompany/dartshowplatform:automated
atsigncompany/dartshowplatform:${{ env.DART_VERSION }}
atsigncompany/dartshowplatform:GHA_${{ github.run_number }}
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
linux/riscv64
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@3691ccf4763537d6e544bc6cdcccc1965799d056 # releases/v1
with:
name: New images build for Dart SDK ${{ env.DART_VERSION }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
update_version_in_repo:
if: ${{ github.event_name != 'workflow_dispatch' }}
needs: [check_for_new_stable, build_multi_arch_images]
env:
DART_VERSION: ${{ needs.check_for_new_stable.outputs.dartversion }}
runs-on: ubuntu-latest
steps:
- name: checkout_to_update_version
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Update stable version
id: dartversion
run: |
echo "$DART_VERSION" > DART_STABLE_VERSION
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
token: ${{ secrets.MY_GITHUB_TOKEN }}
commit-message: 'chore: Bump DART_VERSION file to match latest Stable release'
committer: library-action[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: library-action[bot] <41898282+github-actions[bot]@users.noreply.github.com>
signoff: false
add-paths: .
branch: bot-new-stable-version
delete-branch: true
title: 'chore: New DART_STABLE_VERSION'
body: |
Bumping version tracking file after updating Docker images.
labels: |
operations
assignees: cpswan
reviewers: gkc
draft: false