release #73
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
# .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.21.3', ] | |
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 and push Git tag | |
run: | | |
git tag ${{ github.event.inputs.tag }} | |
git push --tags | |
- 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: isbang/[email protected] | |
with: | |
compose-file: "/home/runner/work/fq-connector-go/fq-connector-go/tests/infra/datasource/docker-compose.yaml" | |
down-flags: "--volumes" | |
- name: Run integration tests | |
run: | | |
# give datasources some time to initialize | |
sleep 3 | |
go test -c -o fq-connector-go-tests ./tests | |
./fq-connector-go-tests -projectPath=$(pwd) | |
- 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 }} |