temporarily disable freebsd bootstrapping #147
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: Build Images | |
on: | |
push: | |
branches: | |
- master | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: nscloud | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- 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: true | |
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 QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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@v5 | |
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 |