Skip to content

Commit 757e36a

Browse files
authored
Create go.yml
1 parent 9b500f7 commit 757e36a

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/go.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: Build Go project
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: '1.22' # Buradaki sürümü projenizde kullandığınız Go sürümüne göre ayarlayın
21+
22+
- name: Build
23+
run: go build -o app
24+
25+
- name: Archive build
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: CustomCache
29+
path: ./app
30+
31+
release:
32+
name: Create Release
33+
needs: build
34+
runs-on: ubuntu-latest
35+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
36+
37+
steps:
38+
- name: Download build
39+
uses: actions/download-artifact@v2
40+
with:
41+
name: CustomCache
42+
path: ./app
43+
44+
- name: Create Release
45+
id: create_release
46+
uses: actions/create-release@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
tag_name: v${{ github.run_number }}
51+
release_name: Release ${{ github.run_number }}
52+
body: |
53+
Release ${{ github.run_number }}
54+
draft: false
55+
prerelease: false
56+
57+
- name: Upload Release Asset
58+
id: upload-release-asset
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.create_release.outputs.upload_url }}
64+
asset_path: ./app/CustomCache
65+
asset_name: CustomCache
66+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)