Add more dependencies for toolchain container, build scripts #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Toolchain container build | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'land/binutils/**' | |
- 'land/gcc/**' | |
- 'land/newlib/**' | |
- 'Containerfile' | |
- '.github/workflows/toolchain.yml' | |
jobs: | |
toolchain: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out git repository | |
uses: actions/checkout@v4 | |
- name: Prepare environment | |
id: prep | |
run: | | |
TAG=$(echo $GITHUB_SHA | head -c7) | |
IMAGE="ghcr.io/${{ github.repository }}/toolchain" | |
echo ::set-output name=tagged_image::${IMAGE}:${TAG} | |
echo ::set-output name=tag::${TAG} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx | |
- name: Building image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
file: Containerfile | |
push: true | |
tags: | | |
${{ steps.prep.outputs.tagged_image }} | |
ghcr.io/${{ github.repository }}/toolchain:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |