Skip to content

update

update #915

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: ReleaseDockerImage
on:
push:
branches: [ "master" ]
#pull_request:
# branches: [ "master" ]
jobs:
build:
if: github.repository == 'admpub/nging'
runs-on: ubuntu-latest
# container:
# image: admpub/xgo:1.21.6
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.3'
- name: Build for all platforms
run: |
mkdir -p "$GOPATH/src/github.com/admpub"
ln -s "$(pwd)" "$GOPATH/src/github.com/admpub/nging"
go mod vendor
cd ./tool/nging-builder
./run.sh linux_amd64
./run.sh linux_arm64
./run.sh linux_386
cd ../../
env:
GOPATH: /home/runner/go
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version
id: version
run: |
VERSION=$(grep NgingVersion ./tool/nging-builder/builder.conf | sed 's/NgingVersion[ ]*:[ ]*//g' | sed 's/"//g' | sed 's/ //g')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build and push multi-arch Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: |
admpub/nging:latest
admpub/nging:${{ steps.version.outputs.version }}
build-args: |
VERSION=${{ steps.version.outputs.version }}
# - name: Test
# run: go test -v ./...