mirror of
https://github.com/Soccera1/agg.git
synced 2025-09-20 13:47:28 +02:00
add github workflow
This commit is contained in:
parent
e0cc903f82
commit
b23f0ad49d
2 changed files with 127 additions and 1 deletions
|
@ -3,7 +3,7 @@ name: Create Release on Push
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master # or your default branch, e.g., master
|
- master # or your default branch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_release_linux:
|
build_and_release_linux:
|
||||||
|
|
126
.github/workflows/release.yml
vendored
Normal file
126
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
name: Create Release on Push (GitHub)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master # or your default branch, e.g., master
|
||||||
|
workflow_dispatch: # Allows manual triggering of the workflow
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y build-essential
|
||||||
|
|
||||||
|
- name: Build project for Linux
|
||||||
|
run: make all
|
||||||
|
working-directory: agg
|
||||||
|
|
||||||
|
- name: Upload Linux artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: agg-linux-amd64
|
||||||
|
path: agg/bin/agg
|
||||||
|
|
||||||
|
build_windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install MinGW/GCC and Make
|
||||||
|
run: |
|
||||||
|
choco install mingw --limit-features
|
||||||
|
choco install make --limit-features
|
||||||
|
# Add MinGW bin directory to PATH for the current session
|
||||||
|
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
|
- name: Build project for Windows
|
||||||
|
run: make all
|
||||||
|
working-directory: agg
|
||||||
|
shell: bash # Choco-installed make typically comes with Git Bash, which provides `bash`.
|
||||||
|
|
||||||
|
- name: Upload Windows artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: agg-windows-amd64
|
||||||
|
path: agg/bin/agg.exe
|
||||||
|
|
||||||
|
create_release_and_upload_assets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build_linux, build_windows] # Depends on both build jobs to complete
|
||||||
|
permissions:
|
||||||
|
contents: write # Grant write permissions to the GITHUB_TOKEN for creating releases
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get latest tag
|
||||||
|
id: get_tag
|
||||||
|
run: |
|
||||||
|
# Get the latest tag, or default to v0.0.0 if no tags exist
|
||||||
|
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
||||||
|
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Increment the patch version for the new release
|
||||||
|
# Assuming tags are in semver format like vX.Y.Z
|
||||||
|
if [ "$LATEST_TAG" = "v0.0.0" ]; then
|
||||||
|
NEW_TAG="v0.0.1"
|
||||||
|
else
|
||||||
|
NEW_PATCH=$(echo $LATEST_TAG | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
|
||||||
|
NEW_TAG="v${NEW_PATCH#v}" # Remove 'v' if present from the awk output
|
||||||
|
fi
|
||||||
|
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the default GITHUB_TOKEN
|
||||||
|
with:
|
||||||
|
tag_name: ${{ env.NEW_TAG }}
|
||||||
|
release_name: Release ${{ env.NEW_TAG }}
|
||||||
|
body: |
|
||||||
|
Automated release created on push.
|
||||||
|
Commit: ${{ github.sha }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Download Linux artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: agg-linux-amd64
|
||||||
|
path: ./artifacts/linux/
|
||||||
|
|
||||||
|
- name: Download Windows artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: agg-windows-amd64
|
||||||
|
path: ./artifacts/windows/
|
||||||
|
|
||||||
|
- name: Upload Linux Release Asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./artifacts/linux/agg
|
||||||
|
asset_name: agg-${{ env.NEW_TAG }}-linux-amd64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
|
- name: Upload Windows Release Asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./artifacts/windows/agg.exe
|
||||||
|
asset_name: agg-${{ env.NEW_TAG }}-windows-amd64.exe
|
||||||
|
asset_content_type: application/octet-stream
|
Loading…
Add table
Reference in a new issue