Skip to content

Add goreleaser (#29) #46

Add goreleaser (#29)

Add goreleaser (#29) #46

Workflow file for this run

name: CLI
on:
pull_request:
branches: ['main']
paths:
- .github/actions/**
- .github/workflows/cli.yml
- cli/**
- src/Cli/**
- src/Cli.Tests/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/**
- .github/workflows/cli.yml
- cli/**
- src/Cli/**
- src/Cli.Tests/**
env:
CI: true
ContinuousIntegrationBuild: true
jobs:
build-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: tree:0
- uses: ./.github/actions/build-cs
id: upload
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
restore-tools: true
lint: true
pack: ${{ github.event_name == 'push' }}
path: src/Cli
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
publish-cli:
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: ['build-cli']
strategy:
matrix:
source: ['nuget', 'github']
env:
PACKAGE_PATTERN: UnMango.Tdl.*.nupkg
permissions:
packages: write
steps:
- uses: actions/download-artifact@v4
with:
name: nuget
- name: Publish to NuGet.org
if: matrix.source == 'nuget'
run: |
dotnet nuget push "$PACKAGE_PATTERN" \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }} \
--skip-duplicate
- name: Publish to GitHub Packages
if: matrix.source == 'github'
run: |
dotnet nuget push "$PACKAGE_PATTERN" \
--source https://nuget.pkg.github.com/${{ github.repository_owner }} \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--skip-duplicate
build-go:
runs-on: ubuntu-latest
strategy:
matrix:
tool:
- uml2go
- uml2pcl
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-go
with:
path: cli/${{ matrix.tool }}
gomod: cli/go.mod
goreleaser:
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: [build-go]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.22.2'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}