|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +# |
| 19 | +name: Release |
| 20 | + |
| 21 | +on: |
| 22 | + push: |
| 23 | + tags: |
| 24 | + - 'v*' |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: write |
| 28 | + |
| 29 | +jobs: |
| 30 | + release: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + include: |
| 35 | + - goos: linux |
| 36 | + goarch: amd64 |
| 37 | + - goos: linux |
| 38 | + goarch: arm64 |
| 39 | + - goos: darwin |
| 40 | + goarch: amd64 |
| 41 | + - goos: darwin |
| 42 | + goarch: arm64 |
| 43 | + - goos: windows |
| 44 | + goarch: amd64 |
| 45 | + - goos: windows |
| 46 | + goarch: arm64 |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Check out code |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up Go |
| 53 | + uses: actions/setup-go@v5 |
| 54 | + with: |
| 55 | + go-version: '1.25.0' |
| 56 | + |
| 57 | + - name: Build |
| 58 | + env: |
| 59 | + GOOS: ${{ matrix.goos }} |
| 60 | + GOARCH: ${{ matrix.goarch }} |
| 61 | + CGO_ENABLED: '0' |
| 62 | + run: | |
| 63 | + BINARY=logtail |
| 64 | + if [ "$GOOS" = "windows" ]; then |
| 65 | + BINARY=logtail.exe |
| 66 | + fi |
| 67 | + go build -trimpath -ldflags="-s -w" -o "${BINARY}" logtail.go |
| 68 | + ARCHIVE="logtail-${GITHUB_REF_NAME}-${GOOS}-${GOARCH}" |
| 69 | + if [ "$GOOS" = "windows" ]; then |
| 70 | + zip "${ARCHIVE}.zip" "${BINARY}" |
| 71 | + else |
| 72 | + tar czf "${ARCHIVE}.tar.gz" "${BINARY}" |
| 73 | + fi |
| 74 | +
|
| 75 | + - name: Upload release assets |
| 76 | + uses: softprops/action-gh-release@v2 |
| 77 | + with: |
| 78 | + files: | |
| 79 | + logtail-*.tar.gz |
| 80 | + logtail-*.zip |
0 commit comments