Skip to content

fix

fix #117

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "chore/workflow-create-release-on-tag" ]
pull_request:
branches: [ "chore/workflow-create-release-on-tag" ]
create:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Check Golang imports order and formatting
uses: Jerome1337/[email protected]
- name: Test
run: CGO_ENABLED=0 go test -v ./...
- name: Build Linux
run: |
export GOOS=linux
export GARCH=amd64
CGO_ENABLED=0 go build -o tm_catalog_cli-${GOOS}_${GARCH}
- name: Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
files:
tm_catalog_cli-linux_amd64
token: ${{ secrets.GITHUB_TOKEN }}
docker:
if: startsWith(github.ref, 'refs/tags')
needs: build
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}