Skip to content

Commit

Permalink
fix(gha): update ci worflow
Browse files Browse the repository at this point in the history
Signed-off-by: kaanyagci <kaan.yagci@makepad.fr>
  • Loading branch information
kaanyagci committed Aug 12, 2024
1 parent 55e19cf commit aff907b
Showing 1 changed file with 105 additions and 15 deletions.
120 changes: 105 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
push:
paths:
- '**.go'
tags:
- 'v*.*.*' # Triggers the workflow on version tags (e.g., v1.0.0)

pull_request:
paths:
- '**.go'
- '.github/workflows/**'


release:
types: [created]

jobs:
build:
Expand Down Expand Up @@ -43,7 +42,6 @@ jobs:
chmod +x skaffold
sudo mv skaffold /usr/local/bin
- name: Set up Go
uses: actions/setup-go@v5.0.2
with:
Expand All @@ -57,28 +55,120 @@ jobs:
- name: Run tests
run: make test

- name: Upload artifact (only for release)
if: github.event_name == 'release'
uses: actions/upload-artifact@v4.3.6
- name: Upload build artifacts
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: kickstart-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/kickstart-${{ matrix.goos }}-${{ matrix.goarch }}

release:
name: Create GitHub Release
name: Create Release and Upload Assets
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
- name: Checkout code
uses: actions/checkout@v3

- name: Download Linux AMD64 Artifact
uses: actions/download-artifact@v3
with:
name: kickstart-linux-amd64

- name: Download Linux ARM64 Artifact
uses: actions/download-artifact@v3
with:
name: kickstart-linux-arm64

- name: Download Darwin AMD64 Artifact
uses: actions/download-artifact@v3
with:
path: dist
name: kickstart-darwin-amd64

- name: Download Darwin ARM64 Artifact
uses: actions/download-artifact@v3
with:
name: kickstart-darwin-arm64

- name: Download Windows AMD64 Artifact
uses: actions/download-artifact@v3
with:
name: kickstart-windows-amd64

- name: Download Windows ARM64 Artifact
uses: actions/download-artifact@v3
with:
name: kickstart-windows-arm64

- name: Create GitHub Release
uses: softprops/action-gh-release@v2.0.8
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: false
prerelease: false

- name: Upload Linux AMD64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-linux-amd64
asset_name: kickstart-linux-amd64
asset_content_type: application/octet-stream

- name: Upload Linux ARM64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-linux-arm64
asset_name: kickstart-linux-arm64
asset_content_type: application/octet-stream

- name: Upload Darwin AMD64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-darwin-amd64
asset_name: kickstart-darwin-amd64
asset_content_type: application/octet-stream

- name: Upload Darwin ARM64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-darwin-arm64
asset_name: kickstart-darwin-arm64
asset_content_type: application/octet-stream

- name: Upload Windows AMD64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-windows-amd64.exe
asset_name: kickstart-windows-amd64.exe
asset_content_type: application/octet-stream

- name: Upload Windows ARM64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kickstart-windows-arm64.exe
asset_name: kickstart-windows-arm64.exe
asset_content_type: application/octet-stream

0 comments on commit aff907b

Please sign in to comment.