Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipelines fix #9

Merged
merged 1 commit into from
Aug 3, 2024
Merged
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
147 changes: 99 additions & 48 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,112 @@
name: Build, Docker, and Release

on:
'on':
push:
branches:
- main
- 'feature/*'
- 'fix/*'

- feature/*
- fix/*
env:
VERSION_FILE: VERSION
DOCKER_IMAGE: ghcr.io/${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
exclude:
- goos: windows
goarch: arm64
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Bump version
run: make version-bump

- name: Read version
id: version
run: echo "::set-output name=version::$(cat $(VERSION_FILE))"

- name: Run tests
run: go test ./...

- name: Build for ${{ matrix.goos }}-${{ matrix.goarch }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -o kado-${{ matrix.goos }}-${{ matrix.goarch }}
if [ "${{ matrix.goos }}" = "windows" ]; then
mv kado-${{ matrix.goos }}-${{ matrix.goarch }} kado-${{ matrix.goos }}-${{ matrix.goarch }}.exe
fi

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: kado-${{ matrix.goos }}-${{ matrix.goarch }}
path: kado-${{ matrix.goos }}-${{ matrix.goarch }}*

docker:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Build Docker image
run: make docker-build

- name: Push Docker image to GitHub Packages
run: |
docker push ${{ env.DOCKER_IMAGE }}:latest
#docker push ${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.version }}

release:
needs:
- build
- docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.x'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Bump version
run: make version-bump

- name: Read version
id: version
run: echo "::set-output name=version::$(cat $(VERSION_FILE))"

- name: Run tests
run: |
go test ./...

- name: Build Docker image
run: make docker-build

- name: Push Docker image to GitHub Packages
run: |
docker push ${{ env.DOCKER_IMAGE }}:latest
#docker push ${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.version }}

- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
files: kado
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v2

- name: Download all artifacts
uses: actions/download-artifact@v2

- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
files: |
kado-linux-amd64
kado-linux-arm64
kado-windows-amd64.exe
kado-darwin-amd64
kado-darwin-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading