Skip to content

Fix GH action for running unit tests (#1992) #797

Fix GH action for running unit tests (#1992)

Fix GH action for running unit tests (#1992) #797

Workflow file for this run

name: Release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Set GORELEASER_PREVIOUS_TAG in actual release
if: ${{ !contains(github.ref, '-nightly') }}
# find previous tag by filtering out nightly tags and choosing the
# second to last tag (last one is the current release)
run: |
prev_tag=$(git tag | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1)
echo "GORELEASER_PREVIOUS_TAG=$prev_tag" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
build-push-docker-image:
name: Build and push Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Makes no sense to have an image with tag v0, hence the check in the last line.
tags: |
type=semver,pattern={{raw}}
type=raw,value=latest-nightly,enable=${{ contains(github.ref, '-nightly') }}
type=semver,pattern=v{{major}}.{{minor}},enable=${{ !contains(github.ref, '-nightly') }}
type=semver,pattern=v{{major}},enable=${{ !contains(github.ref, '-nightly') && !startsWith(github.ref, 'refs/tags/v0.') }}
labels: |
maintainer=ConduitIO
org.opencontainers.image.title=Conduit
org.opencontainers.image.description=Conduit is a data streaming tool written in Go. It aims to provide the best user experience for building and running real-time data pipelines. Conduit comes with batteries included, it provides a UI, common connectors, transforms and observability data out of the box.
org.opencontainers.image.vendor=ConduitIO
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}