release #7
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 | |
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 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: jessehouwing/actions-semver-checker@v1 | |
with: | |
warn-minor-version: true | |
- 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: GOOS=linux go build -v -o fq-connector-go ./app | |
- name: Test | |
run: go test -v ./app/... | |
- 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 }} . | |
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: Create and push Git tag | |
run: | | |
git tag ${{ github.event.inputs.tag }} | |
git push --tags |