Skip to content

ci(ci): update dependency-maintenance skill and refresh GitHub Actions #560

ci(ci): update dependency-maintenance skill and refresh GitHub Actions

ci(ci): update dependency-maintenance skill and refresh GitHub Actions #560

Workflow file for this run

name: all-tools
permissions:
contents: read
actions: read
packages: write
on:
push:
branches:
- main
paths:
- "operations/cli/**"
- ".github/workflows/all-tools.yml"
- ".nvmrc"
pull_request:
branches:
- main
paths:
- "operations/cli/**"
- ".github/workflows/all-tools.yml"
- ".nvmrc"
jobs:
changes:
runs-on: gha-lfdt-lineth-ss-ubuntu-24-amd64-small
name: Filter commit changes
outputs:
all-tools: ${{ steps.filter.outputs['all-tools'] }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Filter commit changes
uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 #v3.0.3
id: filter
with:
base: ${{ github.ref }}
list-files: "json"
filters: |
all-tools:
- 'operations/cli/**'
- '.github/workflows/all-tools.yml'
- '.github/workflows/reusable-*.yml'
- '.nvmrc'
store_image_name_and_tags:
uses: ./.github/workflows/reusable-store-image-name-and-tags.yml
check_image_tags_exist:
runs-on: gha-lfdt-lineth-ss-ubuntu-24-amd64-small
name: Check image tags exist
needs: [changes, store_image_name_and_tags]
if: ${{ needs.changes.outputs['all-tools'] == 'false' }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Check image tags exist
uses: ./.github/actions/check-image-tags-exist
with:
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }}
image_name: consensys/linea-alltools
all-tools-tag-only:
runs-on: gha-lfdt-lineth-ss-ubuntu-24-amd64-small
name: All tools tag only
needs: [changes, store_image_name_and_tags, check_image_tags_exist]
if: ${{ github.event_name != 'pull_request' && needs.changes.outputs['all-tools'] == 'false' }}
outputs:
image_tagged: ${{ steps.image_tag_push.outputs.image_tagged }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Tag and push image
id: image_tag_push
uses: ./.github/actions/image-tag-and-push
with:
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }}
develop_tag: ${{ needs.store_image_name_and_tags.outputs.develop_tag }}
image_name: consensys/linea-alltools
last_commit_tag_exists: ${{ needs.check_image_tags_exist.outputs.last_commit_tag_exists }}
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
build-and-publish:
needs: [changes, store_image_name_and_tags, all-tools-tag-only]
if: ${{ always() && needs.store_image_name_and_tags.outputs.commit_tag != '' && (needs.changes.outputs['all-tools'] == 'true' || needs.all-tools-tag-only.result != 'success' || needs.all-tools-tag-only.outputs.image_tagged != 'true') }}
# ~0.5 mins saved vs small
runs-on: gha-lfdt-lineth-ss-ubuntu-24-amd64-med
env:
COMMIT_TAG: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
DEVELOP_TAG: ${{ needs.store_image_name_and_tags.outputs.develop_tag }}
IMAGE_NAME: consensys/linea-alltools
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
name: All tools build and push
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 #v3.7.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Note: Building arm* images on QEMU emulator can get extremely slow
# when downloading large packages with npm / yarn. Arm* based docker
# images are not necessarily needed as we run amd64 machines for most
# cases. We can later set up self-hosted arm64 github runners if we
# want arm* based images back.
# - name: Set up QEMU
# uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 #v3.7.0
# with:
# platforms: 'arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f #v3.12.0
- name: Validate version tag
run: |
if [[ -z "${{ env.COMMIT_TAG }}" ]]; then
echo "::error::COMMIT_TAG is empty — this usually means the upstream version-tag job was cancelled or failed. Failing early to avoid an invalid Docker tag."
exit 1
fi
echo "We inject the commit tag in the docker image ${{ env.COMMIT_TAG }}"
- name: "Get Node.js version"
id: get-node-version
uses: ./.github/actions/get-node-version
- name: Build and push all tools image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: ./operations/cli/Dockerfile
platforms: linux/amd64 # Note: Build amd64 image only
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: ${{ github.actor != 'dependabot[bot]' && format('type=registry,ref={0}:buildcache,mode=max', env.IMAGE_NAME) || '' }}
build-args: |
NODE_VERSION=${{ steps.get-node-version.outputs.node-version }}
notify:
needs:
[
changes,
store_image_name_and_tags,
check_image_tags_exist,
all-tools-tag-only,
build-and-publish,
]
if: ${{ always() && github.ref == 'refs/heads/main' && contains(needs.*.result, 'failure') }}
uses: ./.github/workflows/slack-notify-failed-jobs.yml
with:
title: "All tools workflow failed"
run_id: ${{ github.run_id }}
secrets:
channel_id: ${{ secrets.SLACK_ENGINEERING_ALERTS_CHANNEL_ID }}
slack_bot_token: ${{ secrets.SLACK_GITHUB_ACTIONS_ALERTS_BOT_TOKEN }}