go1.25.3,go1.24.9 (#286) #191
This file contains hidden or 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: namespace-profile-xgo | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - 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@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: build toolchain image | |
| uses: docker/build-push-action@v6 | |
| if: steps.toolchain_build.outputs.value != '0' | |
| with: | |
| context: docker/toolchain/ | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| techknowlogick/xgo:toolchain | |
| ghcr.io/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@v6 | |
| with: | |
| context: docker/${{ steps.golang_version_1.outputs.value }}/ | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}-base | |
| ghcr.io/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@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }} | |
| techknowlogick/xgo:${{ steps.golang_version_1.outputs.wildcard }} | |
| techknowlogick/xgo:latest | |
| ghcr.io/techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }} | |
| ghcr.io/techknowlogick/xgo:${{ steps.golang_version_1.outputs.wildcard }} | |
| ghcr.io/techknowlogick/xgo:latest | |
| 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://ghcr.io/techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}-base | |
| - name: build golang ${{ steps.golang_version_2.outputs.value }} image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/${{ steps.golang_version_2.outputs.value }}/ | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }}-base | |
| ghcr.io/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@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }} | |
| techknowlogick/xgo:${{ steps.golang_version_2.outputs.wildcard }} | |
| ghcr.io/techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }} | |
| ghcr.io/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://ghcr.io/techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }}-base |