Skip to content

go1.23.2,go1.22.8 (#253) #142

go1.23.2,go1.22.8 (#253)

go1.23.2,go1.22.8 (#253) #142

Workflow file for this run

name: Build Images
on:
push:
branches:
- master
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
# FIXME: https://github.com/jlumbroso/free-disk-space/issues/17
- name: same as 'large-packages' but without 'google-cloud-sdk'
shell: bash
run: |
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: get golang version 1
run: |
export VERSION=$(cat .golang_version | awk -F',' '{print $1}' | sed 's/go1/go-1/')
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo "value=$VERSION.0" >> $GITHUB_OUTPUT
echo "wildcard=$VERSION.x" >> $GITHUB_OUTPUT
else
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "wildcard=$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')" >> $GITHUB_OUTPUT
fi
id: golang_version_1
- name: get golang version 2
run: |
export VERSION=$(cat .golang_version | awk -F',' '{print $2}' | sed 's/go1/go-1/')
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo "value=$VERSION.0" >> $GITHUB_OUTPUT
echo "wildcard=$VERSION.x" >> $GITHUB_OUTPUT
else
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "wildcard=$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')" >> $GITHUB_OUTPUT
fi
id: golang_version_2
- name: get if toolchain should be built
run: |
export VAL=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep "docker/toolchain" | wc -l | awk '{print $1}')
echo $VAL
echo "value=$(echo -n $VAL)" >> $GITHUB_OUTPUT
id: toolchain_build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build toolchain image
uses: docker/build-push-action@v4
if: steps.toolchain_build.outputs.value != '0'
with:
context: docker/toolchain/
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:toolchain
push: true
file: docker/toolchain/Dockerfile
- name: build golang ${{ steps.golang_version_1.outputs.value }} image base
uses: docker/build-push-action@v4
with:
context: docker/${{ steps.golang_version_1.outputs.value }}/
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}-base
push: true
file: docker/${{ steps.golang_version_1.outputs.value }}/Dockerfile
build-contexts: |
toolchain=docker-image://techknowlogick/xgo:toolchain
- name: build golang ${{ steps.golang_version_1.outputs.value }} image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }},techknowlogick/xgo:${{ steps.golang_version_1.outputs.wildcard }}
push: true
build-args: |
VERSION=${{ steps.golang_version_1.outputs.value }}
file: docker/build/Dockerfile
build-contexts: |
${{ steps.golang_version_1.outputs.value }}-base=docker-image://techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}-base
- name: build golang ${{ steps.golang_version_2.outputs.value }} image
uses: docker/build-push-action@v4
with:
context: docker/${{ steps.golang_version_2.outputs.value }}/
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }}-base
push: true
file: docker/${{ steps.golang_version_2.outputs.value }}/Dockerfile
build-contexts: |
toolchain=docker-image://techknowlogick/xgo:toolchain
- name: build golang ${{ steps.golang_version_2.outputs.value }} image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }},techknowlogick/xgo:${{ steps.golang_version_2.outputs.wildcard }}
push: true
build-args: |
VERSION=${{ steps.golang_version_2.outputs.value }}
file: docker/build/Dockerfile
build-contexts: |
${{ steps.golang_version_2.outputs.value }}-base=docker-image://techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }}-base
- name: build latest image
uses: docker/build-push-action@v4
with:
context: docker/go-latest/
platforms: linux/amd64
#,linux/arm64
tags: techknowlogick/xgo:latest
push: true
file: docker/go-latest/Dockerfile