Skip to content

release

release #130

Workflow file for this run

# .github/workflows/release.yml
name: release
on:
workflow_dispatch:
inputs:
tag:
description: 'New tag name'
required: true
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.22.0', ]
steps:
- name: Fail if branch is not main
if: github.ref != 'refs/heads/main'
run: |
echo "This workflow should not be triggered with workflow_dispatch on a branch other than main"
exit 1
- name: Fail if user is not admin
if: github.actor != 'vitalyisaev2' && github.actor != 'uzhastik'
run: |
echo "This workflow should be triggered only by repository admins"
exit 1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create git tag
run: |
git tag ${{ github.event.inputs.tag }}
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: |
go get ./...
- name: Build
run: |
echo "GOOS=linux" >> $GITHUB_ENV
echo "GOARCH=amd64" >> $GITHUB_ENV
go run ./tools/version git
go build -v -o fq-connector-go ./app
- name: Run unit tests
run: go test -v ./app/...
- name: Setup integration tests
uses: hoverkraft-tech/[email protected]
with:
compose-file: "tests/infra/datasource/docker-compose.yaml"
up-flags: "--build"
down-flags: "--volumes"
- name: Run integration tests
run: |
# cleanup some cache
go clean -cache
sudo rm -rf /usr/share/dotnet
# run tests
go test -c -o fq-connector-go-tests ./tests
./fq-connector-go-tests -projectPath=$(pwd)
# Build and tests are OK - only now we can push the tag
- name: Push git tag
run: |
git push --tags
- name: Build binary package
run: |
cp ./app/server/config/config.prod.yaml fq-connector-go.yaml
cp ./examples/systemd/fq-connector-go.service .
tar czf fq-connector-go-${{ github.event.inputs.tag }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz fq-connector-go fq-connector-go.yaml fq-connector-go.service
- name: Build and push Docker image
run: |
docker login --username vitalyisaev2 --password ${{ secrets.GHCR_TOKEN }} ghcr.io
docker build -t ghcr.io/ydb-platform/fq-connector-go:${{ github.event.inputs.tag }} -f Dockerfile.release .
docker tag ghcr.io/ydb-platform/fq-connector-go:${{ github.event.inputs.tag }} ghcr.io/ydb-platform/fq-connector-go:latest
docker push ghcr.io/ydb-platform/fq-connector-go:${{ github.event.inputs.tag }}
docker push ghcr.io/ydb-platform/fq-connector-go:latest
- name: Make release on Github
uses: softprops/action-gh-release@v1
with:
files: |
fq-connector-go-${{ github.event.inputs.tag }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz
tag_name: ${{ github.event.inputs.tag }}