Skip to content

AutoBuildAll

AutoBuildAll #1242

Workflow file for this run

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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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