Skip to content

build: release v1.6.0. #317

build: release v1.6.0.

build: release v1.6.0. #317

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: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest, windows-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 ./...
release:
needs: build
runs-on: ubuntu-latest-l
timeout-minutes: 15
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: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dry-run:
needs: build
runs-on: ubuntu-latest-l
timeout-minutes: 20
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Run GoReleaser Snapshot
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image - core (dry run)
uses: docker/build-push-action@v5
with:
context: .
file: ./distro/core/Dockerfile
platforms: linux/amd64,linux/arm64
push: false
tags: outofcoffee/imposter:5-beta
build-args: |
VERSION=dev
- name: Build Docker image - all (dry run)
uses: docker/build-push-action@v5
with:
context: .
file: ./distro/all/Dockerfile
platforms: linux/amd64,linux/arm64
push: false
tags: outofcoffee/imposter-all:5-beta
build-args: |
VERSION=dev
publish-plugins:
needs: release
runs-on: ubuntu-latest-m
timeout-minutes: 10
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/v}" >> $GITHUB_OUTPUT
- name: Create draft release in imposter-go-plugins repo
id: create_release
run: |
gh release create "v${{ steps.version.outputs.VERSION }}" \
--repo imposter-project/imposter-go-plugins \
--title "Plugins v${{ steps.version.outputs.VERSION }}" \
--notes "External plugins for imposter-go ${{ 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 "v${{ 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 "v${{ steps.version.outputs.VERSION }}" \
--repo imposter-project/imposter-go-plugins \
--draft=false
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_REPO_TOKEN }}
docker:
needs: release
runs-on: ubuntu-latest-l
timeout-minutes: 20
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push Docker image - core
uses: docker/build-push-action@v5
with:
context: .
file: ./distro/core/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: outofcoffee/imposter:5-beta
build-args: |
VERSION=${{ steps.version.outputs.VERSION }}
- name: Build and push Docker image - all
uses: docker/build-push-action@v5
with:
context: .
file: ./distro/all/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: outofcoffee/imposter-all:5-beta
build-args: |
VERSION=${{ steps.version.outputs.VERSION }}