995b08f09fe99d4c5a4b15e27bd50fbb33910d24

Author
Maxime BORGES <contact@maximeborg.es>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Create release.yml

Diff

 1diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..35191847b30ad87c00fc0bdfda5fcc9d1e1187a8
 4--- /dev/null
 5+++ b/.github/workflows/release.yml
 6@@ -0,0 +1,56 @@
 7+name: Release
 8+
 9+on:
10+  push:
11+    tags:
12+      - 'v*.*'
13+
14+jobs:
15+  create_release:
16+    name: Create release
17+    runs-on: ubuntu-latest
18+    outputs:
19+      upload_url: ${{ steps.create_release.outputs.upload_url }}
20+    steps:
21+    - name: Create Release
22+      id: create_release
23+      uses: actions/create-release@v1
24+      env:
25+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+      with:
27+        tag_name: ${{ github.ref }}
28+        release_name: Release ${{ github.ref_name }}
29+  
30+  build_release:
31+    needs: create_release
32+    runs-on: ubuntu-latest
33+    strategy:
34+      matrix:
35+        goos: [linux, darwin]
36+        goarch: [amd64, arm64]
37+
38+    steps:
39+    - name: Checkout code
40+      uses: actions/checkout@v2
41+
42+    - name: Set up Go
43+      uses: actions/setup-go@v2
44+      with:
45+        go-version: '1.23'
46+
47+    - name: Build
48+      env:
49+        GOOS: ${{ matrix.goos }}
50+        GOARCH: ${{ matrix.goarch }}
51+      run: |
52+        go build -o logfmt-${{ matrix.goos }}-${{ matrix.goarch }}
53+
54+    - name: Upload Release Asset
55+      uses: actions/upload-release-asset@v1
56+      env:
57+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+      with:
59+        upload_url: ${{ needs.create_release.outputs.upload_url }}
60+        asset_path: ./logfmt-${{ matrix.goos }}-${{ matrix.goarch }}
61+        asset_name: logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
62+        asset_content_type: application/octet-stream