Add .gitea/workflows/build.yaml
Some checks failed
Release Version / build (push) Failing after 2m0s
Some checks failed
Release Version / build (push) Failing after 2m0s
This commit is contained in:
parent
9be88aea40
commit
24985812b1
52
.gitea/workflows/build.yaml
Normal file
52
.gitea/workflows/build.yaml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
version: '1'
|
||||||
|
name: Release Version
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.23.1'
|
||||||
|
|
||||||
|
- name: Build Go binary
|
||||||
|
run: |
|
||||||
|
go mod tidy
|
||||||
|
go build -o s3-client
|
||||||
|
|
||||||
|
- name: Create release version
|
||||||
|
id: create_version
|
||||||
|
run: |
|
||||||
|
latest_version=$(git describe --tags --abbrev=0 || echo "v0.0.0")
|
||||||
|
new_version=$(echo $latest_version | awk -F. '{printf "v%d.%d.%d", $1, $2, $3+1}')
|
||||||
|
echo "new_version=$new_version" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
git tag $new_version
|
||||||
|
git push origin $new_version
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ env.new_version }}
|
||||||
|
release_name: Release ${{ env.new_version }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload Go binary to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_version.outputs.upload_url }}
|
||||||
|
asset_path: ./myapp
|
||||||
|
asset_name: myapp_${{ env.new_version }}_linux_amd64
|
||||||
|
asset_content_type: application/octet-stream
|
Loading…
Reference in New Issue
Block a user