Skip to content

Create GH release

Create GH release #29

Workflow file for this run

name: Build Go
on:
push:
branches: [ main ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
paths-ignore: [ "*.md" ]
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILDKIT_PROGRESS: "plain" # Full logs for CI build.
REGISTRY_URL: "docker.io" # docker.io or other target registry URL: where to push images to.
REGISTRY_SRC: "docker.io" # For BASE_NAMESPACE of images: where to pull base images from.
# DOCKER_REGISTRY_USERNAME and DOCKER_REGISTRY_PASSWORD is required for docker image push, they should be set in CI secrets.
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
# used to sync image to mirror registry
DOCKER_MIRROR_REGISTRY_USERNAME: ${{ secrets.DOCKER_MIRROR_REGISTRY_USERNAME }}
DOCKER_MIRROR_REGISTRY_PASSWORD: ${{ secrets.DOCKER_MIRROR_REGISTRY_PASSWORD }}
jobs:
build_docker_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker
run: |
source ./tool.sh
VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX};
build_image_no_tag supervisord "ubuntu-${VER}" src/supervisord.Dockerfile --build-arg "BASE_NAMESPACE=library" --build-arg "BUILD_IMG=golang:alpine" --build-arg "BASE_IMG=alpine"
build_image_no_tag supervisord "alpine-${VER}" src/supervisord.Dockerfile --build-arg "BASE_NAMESPACE=qpod" --build-arg "BUILD_IMG=go:latest" --build-arg "BASE_IMG=ubuntu"
alias_image supervisord "ubuntu-${VER}" supervisord latest
push_image supervisord
build_binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Build Binary
run: |
set -eux
pwd && ls -alh *
mkdir -pv build && mv src/etc src/webgui ./build/
cd src/supervisord
go mod tidy && go test -v
go build -v -o ../../build/
cd ../../
ls -alh build
build_goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Install cross-compiler for linux/arm64, UPX
env:
VER_UPX: "4.2.4"
run: |
sudo apt-get update -q && sudo apt-get -y install gcc-aarch64-linux-gnu ;
URL_UPX="https://github.com/upx/upx/releases/download/v${VER_UPX}/upx-${VER_UPX}-amd64_linux.tar.xz" ;
echo "Installing upx ${VER_UPX} from: ${URL_UPX}" ;
curl -o /tmp/TMP.txz -sL $URL_UPX && tar -C /opt/ -xJf /tmp/TMP.txz && rm /tmp/TMP.txz ;
ln -sf /opt/upx-${VER_UPX}-amd64_linux /opt/upx
export PATH="/opt/upx/:${PATH}"
upx --version | grep -E '^upx'
cd src/supervisord && go mod tidy -e
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
# if not on a `tags/v*` git push, add `--snapshot` to flags
run: echo "flags=--snapshot" >> $GITHUB_ENV
- uses: goreleaser/goreleaser-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GA_TOKEN }}
with:
distribution: goreleaser
version: latest
args: release --verbose --clean ${{ env.flags }}
workdir: src/supervisord