Skip to content

Commit

Permalink
Update CI release
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Nov 3, 2024
1 parent ea463e4 commit 111ec87
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ jobs:
matrix:
os: [macos, ubuntu, windows]
runs-on: ${{ matrix.os }}-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Metadata
shell: bash
run: |
if ${{ startsWith(github.ref, 'refs/tags/v') }}; then
echo "BUILD_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
Expand All @@ -35,16 +34,32 @@ jobs:
go-version: 'stable'

- name: Build
run: go build -v ./...
run: go build -o dr-feeder -trimpath -ldflags "-X main.version=${BUILD_VERSION} -s -w"

- name: Test
run: go test -v ./...

- name: Package
shell: bash
run: tar czf "dr-feeder-${BUILD_VERSION}-${{ matrix.os }}.tar.gz" "./dr-feeder" "./config.yaml"

- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
artifacts: "*.tar.gz"
name: dr-feeder-${{ matrix.os }}
path: ./*.tar.gz

release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v4

- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "*.tar.gz"

0 comments on commit 111ec87

Please sign in to comment.