Skip to content

ci: broadens branch trigger pattern. #261

ci: broadens branch trigger pattern.

ci: broadens branch trigger pattern. #261

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: CI
on:
push:
branches: [ "main", "build/*", "ci/*", "feat/*", "fix/*" ]
tags: [ "v*" ]
pull_request:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git describe
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Build
run: |
make build-plugins
make build
- name: Test
run: go test -v ./...
- name: Run GoReleaser on Tag
if: startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser Dry-Run on Main
if: github.ref == 'refs/heads/main'
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean
publish-plugins:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create draft release in imposter-go-plugins repo
id: create_release
run: |
gh release create ${{ steps.version.outputs.VERSION }} \
--repo imposter-project/imposter-go-plugins \
--title "Plugins ${{ steps.version.outputs.VERSION }}" \
--notes "External plugins for Imposter ${{ steps.version.outputs.VERSION }}" \
--draft
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_REPO_TOKEN }}
- name: Build plugins for multiple platforms
run: ./scripts/build-plugins.sh ${{ steps.version.outputs.VERSION }} dist
- name: Upload plugin binaries as release assets
run: |
for file in dist/*; do
if [ -f "$file" ]; then
echo "Uploading $(basename "$file")"
gh release upload ${{ steps.version.outputs.VERSION }} "$file" \
--repo imposter-project/imposter-go-plugins
fi
done
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_REPO_TOKEN }}
- name: Publish release
run: |
gh release edit ${{ steps.version.outputs.VERSION }} \
--repo imposter-project/imposter-go-plugins \
--draft=false
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_REPO_TOKEN }}