remove data race, fix https://github.com/Altinity/clickhouse-backup/i… #129
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 | |
on: | |
push: | |
tags: | |
- v*.*.* | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
golang-version: | |
- "1.22" | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
id: setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^${{ matrix.golang-version }}' | |
- name: Setup fpm and make | |
run: | | |
sudo apt-get install -y --no-install-recommends ruby ruby-dev gcc g++ rpm musl-dev musl-tools | |
sudo apt-get install --no-install-recommends -y make | |
sudo gem install --no-document fpm | |
# - name: Cache golang | |
# id: cache-golang | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# ~/go/pkg/mod | |
# ~/.cache/go-build | |
# key: clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }} | |
- name: Install golang dependencies | |
run: go mod download -x | |
# if: | | |
# steps.cache-golang.outputs.cache-hit != 'true' | |
- name: Extract DOCKER_TAG version | |
id: docker_tag | |
run: | | |
DOCKER_TAG=${GITHUB_REF##*/} | |
DOCKER_TAG=${DOCKER_TAG##*\\} | |
export DOCKER_TAG=${DOCKER_TAG#v} | |
echo "docker_tag=${DOCKER_TAG:-dev}" >> $GITHUB_OUTPUT | |
- name: Prepare binaries | |
id: make | |
env: | |
GOROOT: ${{ env.GOROOT_1_22_X64 }} | |
run: | | |
make build build-fips config test | |
#make build-fips-darwin | |
- name: Building deb, rpm and tar.gz packages | |
id: make_packages | |
run: | | |
set -x | |
export NAME=clickhouse-backup | |
export VERSION=$(git describe --always --tags --abbrev=0 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/c\1/;s/-/./g') | |
printf "amd64 arm64" | xargs -P 2 -d " " -I {} tar -czvf ${NAME}-linux-{}.tar.gz build/linux/{}/${NAME} | |
printf "amd64 arm64" | xargs -P 2 -d " " -I {} tar -czvf ${NAME}-darwin-{}.tar.gz build/darwin/{}/${NAME} | |
echo "tgz_linux_amd64=${NAME}-linux-amd64.tar.gz" >> $GITHUB_OUTPUT | |
echo "tgz_linux_arm64=${NAME}-linux-arm64.tar.gz" >> $GITHUB_OUTPUT | |
echo "tgz_darwin_amd64=${NAME}-darwin-amd64.tar.gz" >> $GITHUB_OUTPUT | |
echo "tgz_darwin_arm64=${NAME}-darwin-arm64.tar.gz" >> $GITHUB_OUTPUT | |
printf "amd64 arm64" | xargs -P 2 -d " " -I {} tar -czvf ${NAME}-linux-{}-fips.tar.gz build/linux/{}/${NAME}-fips | |
# printf "amd64 arm64" | xargs -P 2 -d " " -I {} tar -czvf ${NAME}-darwin-{}-fips.tar.gz build/darwin/{}/${NAME}-fips | |
echo "tgz_linux_amd64_fips=${NAME}-linux-amd64-fips.tar.gz" >> $GITHUB_OUTPUT | |
echo "tgz_linux_arm64_fips=${NAME}-linux-arm64-fips.tar.gz" >> $GITHUB_OUTPUT | |
# echo "tgz_darwin_amd64_fips=${NAME}-darwin-amd64-fips.tar.gz" >> $GITHUB_OUTPUT | |
# echo "tgz_darwin_arm64_fips=${NAME}-darwin-arm64-fips.tar.gz" >> $GITHUB_OUTPUT | |
make packages | |
cp -lv ./build/linux/*/*.deb ./ | |
cp -lv ./build/linux/*/*.rpm ./ | |
echo "rpm_amd64=${NAME}-${VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT | |
echo "deb_amd64=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT | |
echo "rpm_arm64=${NAME}-${VERSION}-1.aarch64.rpm" >> $GITHUB_OUTPUT | |
echo "deb_arm64=${NAME}_${VERSION}_arm64.deb" >> $GITHUB_OUTPUT | |
- name: Prepare release notes | |
id: release_notes | |
run: | | |
awk '/^# / {s++} s == 1 {print}' ChangeLog.md > /tmp/release_notes.md | |
echo "path=/tmp/release_notes.md" >> $GITHUB_OUTPUT | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
tag_name: v${{ steps.docker_tag.outputs.docker_tag }} | |
name: ${{ steps.docker_tag.outputs.docker_tag }} | |
body_path: ${{ steps.release_notes.outputs.path }} | |
draft: true | |
fail_on_unmatched_files: true | |
files: | | |
${{ steps.make_packages.outputs.rpm_amd64 }} | |
${{ steps.make_packages.outputs.rpm_arm64 }} | |
${{ steps.make_packages.outputs.deb_amd64 }} | |
${{ steps.make_packages.outputs.deb_arm64 }} | |
${{ steps.make_packages.outputs.tgz_linux_amd64 }} | |
${{ steps.make_packages.outputs.tgz_linux_arm64 }} | |
${{ steps.make_packages.outputs.tgz_darwin_amd64 }} | |
${{ steps.make_packages.outputs.tgz_darwin_arm64 }} | |
${{ steps.make_packages.outputs.tgz_linux_amd64_fips }} | |
${{ steps.make_packages.outputs.tgz_linux_arm64_fips }} | |
# ${{ steps.make_packages.outputs.tgz_darwin_amd64_fips }} | |
# ${{ steps.make_packages.outputs.tgz_darwin_arm64_fips }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Building docker image | |
env: | |
DOCKER_REPO: ${{ secrets.DOCKER_REPO }} | |
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
DOCKER_TAG: ${{ steps.docker_tag.outputs.docker_tag }} | |
run: | | |
export DOCKER_REGISTRY=${DOCKER_REGISTRY:-docker.io} | |
echo ${DOCKER_TOKEN} | docker login -u ${DOCKER_USER} --password-stdin ${DOCKER_REGISTRY} | |
export VERSION=$(git describe --always --tags --abbrev=0 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/c\1/;s/-/./g') | |
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:latest --build-arg VERSION=$VERSION --target=image_short --pull --push . | |
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}-fips --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:latest-fips --build-arg VERSION=$VERSION --target=image_fips --pull --push . | |
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:latest --build-arg VERSION=$VERSION --target=image_full --pull --push . |