Skip to content

Commit

Permalink
Completely overhaul the workflows (#140)
Browse files Browse the repository at this point in the history
* Completely overhaul the workflows

* Hopefully fix paths

* Hopefully fix the linter errors

* Whole lot of wonky jank going on

* More go crap
  • Loading branch information
UnstoppableMango authored Jun 9, 2024
1 parent aec76ae commit e50c95f
Show file tree
Hide file tree
Showing 22 changed files with 545 additions and 433 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/cli-echo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: echo CLI

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-go/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-echo.yml
- cli/go.*
- cli/echo/**
- cli/internal/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-go/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-echo.yml
- cli/go.*
- cli/echo/**
- cli/internal/**

jobs:
build:
uses: ./.github/workflows/go-cli.yml
with:
name: echo
28 changes: 28 additions & 0 deletions .github/workflows/cli-um.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: um CLI

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-go/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-um.yml
- cli/go.*
- cli/um/**
- cli/internal/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-go/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-um.yml
- cli/go.*
- cli/um/**
- cli/internal/**

jobs:
build:
uses: ./.github/workflows/go-cli.yml
with:
name: um
33 changes: 33 additions & 0 deletions .github/workflows/cli-uml2go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: uml2go CLI

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-go/**
- .github/actions/build-docker/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-uml2go.yml
- cli/go.*
- cli/uml2go/**
- cli/internal/**
- docker/uml2go/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-go/**
- .github/actions/build-docker/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-uml2go.yml
- cli/go.*
- cli/uml2go/**
- cli/internal/**
- docker/uml2go/**

jobs:
build:
uses: ./.github/workflows/go-cli.yml
with:
name: uml2go
docker: true
33 changes: 33 additions & 0 deletions .github/workflows/cli-uml2pcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: uml2pcl CLI

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-go/**
- .github/actions/build-docker/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-uml2pcl.yml
- cli/go.*
- cli/uml2pcl/**
- cli/internal/**
- docker/uml2pcl/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-go/**
- .github/actions/build-docker/**
- .github/workflows/go-cli.yml
- .github/workflows/cli-uml2pcl.yml
- cli/go.*
- cli/uml2pcl/**
- cli/internal/**
- docker/uml2pcl/**

jobs:
build:
uses: ./.github/workflows/go-cli.yml
with:
name: uml2pcl
docker: true
149 changes: 0 additions & 149 deletions .github/workflows/cli.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/go-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Go CLI tool

on:
workflow_call:
inputs:
name:
description: The name of the tool.
type: string
required: true
docker:
description: Whether the tool has a corresponding container.
type: boolean
default: false

jobs:
build-go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-go
with:
path: cli/${{ inputs.name }}
gomod: cli/go.mod

build-docker:
if: inputs.docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "NAME=$(cat docker/${{ inputs.name }}/.name)" >> "$GITHUB_ENV"
- uses: ./.github/actions/build-docker
with:
file: docker/${{ inputs.name }}/Dockerfile
images: ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}
push: ${{ github.event_name != 'pull_request' }}
token: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Goreleaser

on:
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/workflows/goreleaser.yml
- cli/**

jobs:
goreleaser:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
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@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/packages-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ts package

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-bun/**
- .github/actions/build-docker/**
- .github/workflows/packages-ts.yml
- packages/ts/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-cs/**
- .github/actions/build-docker/**
- .github/workflows/packages-ts.yml
- packages/ts/**

jobs:
build:
uses: ./.github/workflows/ts-cli.yml
with:
name: ts
24 changes: 24 additions & 0 deletions .github/workflows/packages-uml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: uml package

on:
pull_request:
branches: ['main']
paths:
- .github/actions/build-bun/**
- .github/actions/build-docker/**
- .github/workflows/packages-uml.yml
- packages/uml/**
push:
branches: ['main']
tags: ['v*.*.*']
paths:
- .github/actions/build-cs/**
- .github/actions/build-docker/**
- .github/workflows/packages-uml.yml
- packages/uml/**

jobs:
build:
uses: ./.github/workflows/ts-cli.yml
with:
name: uml
Loading

0 comments on commit e50c95f

Please sign in to comment.