Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 3 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ on:
push:
branches:
- "main"
- "dev"
tags:
- "v*.*.*"
pull_request:

permissions:
contents: write

jobs:
go-build-test:
Expand All @@ -20,38 +13,17 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.24.3'

- name: Build
run: make build

- name: Test
run: make test

release-woodpecker-cli:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: go-build-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-docker:
runs-on: ubuntu-latest
needs: go-build-test
permissions: write-all

strategy:
matrix:
Expand All @@ -61,33 +33,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/${{matrix.image}}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: "build/Dockerfile.${{matrix.image}}"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false
20 changes: 20 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pull Request
on:
pull_request:

jobs:
go-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.3'

- name: Build
run: make build

- name: Test
run: make test
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write

jobs:
go-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.3'

- name: Build
run: make build

- name: Test
run: make test

release-woodpecker-cli:
runs-on: ubuntu-latest
needs: go-build-test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.24.3'
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-push-docker:
runs-on: ubuntu-latest
needs: release-woodpecker-cli
permissions: write-all

strategy:
matrix:
image: [ "woodpecker-ai", "woodpecker-executor" ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/${{matrix.image}}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: "build/Dockerfile.${{matrix.image}}"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/operantai/woodpecker

go 1.24.1
go 1.24.3

require (
github.com/charmbracelet/lipgloss v0.9.1
Expand Down