Merge branch 'main' of https://git.fluffy.pw/leafus/s3-client
All checks were successful
Release Version / build (push) Successful in 6s

This commit is contained in:
leafus 2024-09-29 05:11:32 +02:00
commit e72a7a7468

View File

@ -18,12 +18,24 @@ jobs:
with: with:
go-version: '1.23.1' go-version: '1.23.1'
- name: Check if main.go was modified
id: check_main_go
run: |
git fetch origin main
if git diff --name-only HEAD origin/main | grep -q 'main.go'; then
echo "main_go_modified=true" >> $GITHUB_ENV
else
echo "main_go_modified=false" >> $GITHUB_ENV
fi
- name: Build Go binary for Linux - name: Build Go binary for Linux
if: env.main_go_modified == 'true'
run: | run: |
go mod tidy go mod tidy
go build -o s3-client_linux.x86_64 go build -o s3-client_linux.x86_64
- name: Build Go binary for Windows - name: Build Go binary for Windows
if: env.main_go_modified == 'true'
run: | run: |
GOOS=windows GOARCH=amd64 go build -o s3-client_windows.x86_64.exe GOOS=windows GOARCH=amd64 go build -o s3-client_windows.x86_64.exe
@ -36,6 +48,11 @@ jobs:
- name: Get latest version and increment - name: Get latest version and increment
id: create_version id: create_version
run: | run: |
if [ "${{ env.main_go_modified }}" = "false" ]; then
echo "No changes in main.go, skipping version increment and release creation."
exit 0
fi
git fetch --tags git fetch --tags
latest_version=$(git tag | sort -V | tail -n 1 || echo "v0.0.0") latest_version=$(git tag | sort -V | tail -n 1 || echo "v0.0.0")
@ -58,6 +75,7 @@ jobs:
- name: Create Release - name: Create Release
id: create_release id: create_release
if: env.main_go_modified == 'true'
uses: actions/create-release@v1 uses: actions/create-release@v1
with: with:
tag_name: ${{ env.new_version }} tag_name: ${{ env.new_version }}
@ -73,6 +91,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.TOKEN }} GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Upload Go binaries to release - name: Upload Go binaries to release
if: env.main_go_modified == 'true'
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: | files: |