fix goreleaser version #26
Workflow file for this run
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: Release Artifacts | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
REGISTRY: harbor.clyso.com | |
jobs: | |
# build and publish docker images | |
docker: | |
strategy: | |
matrix: | |
service: | |
- worker | |
- proxy | |
- agent | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/chorus/${{ matrix.service }}:${{ github.ref_name }} | |
${{ env.REGISTRY }}/chorus/${{ matrix.service }}:latest | |
build-args: | | |
GIT_TAG=${{ github.ref_name }} | |
GIT_COMMIT=${{ github.sha }} | |
SERVICE=${{ matrix.service }} | |
# publish helm chart | |
helm: | |
needs: docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: read chart version | |
id: chartVer | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq '.version' deploy/chorus/Chart.yaml | |
- name: Install helm | |
uses: azure/[email protected] | |
- name: Publish chart | |
run: | | |
echo "${{ steps.chartVer.outputs.result }}" | |
helm registry login -u '${{ secrets.DOCKER_USER }}' -p ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }} | |
helm package ./deploy/chorus --app-version=${{ github.ref_name }} | |
helm push ./chorus-${{ steps.chartVer.outputs.result }}.tgz oci://${{ env.REGISTRY }}/chorus | |
# publish github Release | |
release: | |
needs: helm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: Install zip | |
uses: montudor/action-zip@v1 | |
- name: Build standalone binaries | |
run: | | |
mkdir standalone | |
platforms=("darwin/amd64" "darwin/arm64" "linux/386" "linux/amd64" "linux/arm64" "windows/amd64" "windows/386" ) | |
for platform in "${platforms[@]}" | |
do | |
platform_split=(${platform//\// }) | |
GOOS=${platform_split[0]} | |
GOARCH=${platform_split[1]} | |
bin_name='chorus' | |
output_name='standalone_'${{ github.ref_name }}'_'$GOOS'_'$GOARCH | |
if [ $GOOS = "windows" ]; then | |
bin_name+='.exe' | |
output_name+='.zip' | |
else | |
output_name+='.tar.gz' | |
fi | |
env GOOS=$GOOS GOARCH=$GOARCH go build -o $bin_name ./cmd/chorus | |
if [ $? -ne 0 ]; then | |
echo 'An error has occurred! Aborting the script execution...' | |
exit 1 | |
fi | |
if [ $GOOS = "windows" ]; then | |
zip -r standalone/$output_name ./$bin_name | |
else | |
tar -cvzf standalone/$output_name ./$bin_name | |
fi | |
rm ./$bin_name | |
done | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
version: v1.25.1 | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BREW_RELEASE_TOKEN: ${{ secrets.BREW_RELEASE_TOKEN }} |