Skip to content

ci: update go pkg publish packages #14

ci: update go pkg publish packages

ci: update go pkg publish packages #14

Workflow file for this run

name: Publish Go Packages
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Configure Git
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Get tag value
id: tag
run: |
TAG=${GITHUB_REF#refs/*/}
echo "Working tag: $TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Build and test packages
env:
VERSION: ${{ steps.tag.outputs.tag }}
run: |
# Enable Go modules
go env -w GO111MODULE=on
# List of packages to build and test
# TODO: it's should be automatically detected from the go.work file
PACKAGES=(
"address"
"automaxprocs"
"cloudkms"
"encryption"
"errors"
"errs"
"postgres"
"redis"
"fixedpoint"
"httpclient"
"logger"
"nullable"
"postgres"
"queue"
"redis"
"utils"
)
# Build and test each package
for PKG in "${PACKAGES[@]}"; do
echo "Building and testing $PKG"
cd $PKG
go mod tidy
go build -v ./...
go test ./...
cd ..
done
# Publish packages
GOPROXY=proxy.golang.org go list -m github.com/Cleverse/go-utilities@$VERSION