fix: goreleaser use compiled binaries in release #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- "master" | |
tags: | |
- "v*" | |
pull_request: | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
dependencies: | |
name: Prepare Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "1.20" | |
- name: Setup dependencies | |
uses: ./.github/actions/deps-setup | |
detect-repo-changes: | |
name: Detected Repo Changes | |
runs-on: ubuntu-latest | |
outputs: | |
code-changed: ${{ steps.filter.outputs.code }} | |
dockerfile-changed: ${{ steps.filter.outputs.docker }} | |
cicd-definition-changed: ${{ steps.filter.outputs.cicd-definitions }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: dorny/[email protected] | |
id: filter | |
with: | |
base: master | |
filters: | | |
code: | |
- 'api/**' | |
- 'config/**' | |
- 'controllers/**' | |
- 'helpers/**' | |
- 'hydra/**' | |
- 'go.mod' | |
- 'go.sum' | |
- '*.go' | |
- 'PROJECT' | |
docker: | |
- '.docker/**' | |
cicd-definitions: | |
- '.github/workflows/**' | |
- '.github/actions/**' | |
gha-lint: | |
name: Lint GithubAction files | |
if: | | |
needs.detect-repo-changes.outputs.cicd-definition-changed == 'true' | |
needs: | |
- detect-repo-changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: actionlint | |
id: actionlint | |
uses: raven-actions/actionlint@v1 | |
with: | |
fail-on-error: true | |
test-build: | |
name: Compile and test | |
runs-on: ubuntu-latest | |
if: | | |
needs.detect-repo-changes.outputs.code-changed == 'true' || | |
github.ref_type == 'tag' | |
needs: | |
- detect-repo-changes | |
- dependencies | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout dependencies | |
uses: ./.github/actions/deps-setup | |
- name: Build | |
run: make manager | |
- name: Test | |
run: make test | |
test-integration: | |
name: Run integration tests | |
runs-on: ubuntu-latest | |
if: | | |
needs.detect-repo-changes.outputs.code-changed == 'true' || | |
needs.detect-repo-changes.outputs.dockerfile-changed == 'true' || | |
github.ref_type == 'tag' | |
needs: | |
- detect-repo-changes | |
- dependencies | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout dependencies | |
uses: ./.github/actions/deps-setup | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
cache: false | |
- name: Test | |
run: make test-integration | |
test-docker: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
if: | | |
needs.detect-repo-changes.outputs.dockerfile-changed == 'true' || | |
github.ref_type == 'tag' | |
needs: | |
- detect-repo-changes | |
- dependencies | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout dependencies | |
uses: ./.github/actions/deps-setup | |
- name: Build image | |
run: make docker-build-notest | |
release: | |
if: github.ref_type == 'tag' | |
needs: | |
- test-build | |
- test-integration | |
- test-docker | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout dependencies | |
uses: ./.github/actions/deps-setup | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |