feat: add release.sh and update changelog.sh #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: arm64 | |
| cc: aarch64-linux-gnu-gcc | |
| - os: macos-15 | |
| goos: darwin | |
| goarch: amd64 | |
| - os: macos-15 | |
| goos: darwin | |
| goarch: arm64 | |
| - os: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: go.mod | |
| - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: "24" | |
| - name: Build frontend | |
| run: npm ci && npm run build | |
| working-directory: frontend | |
| - name: Embed frontend | |
| shell: bash | |
| run: | | |
| rm -rf internal/web/dist | |
| cp -r frontend/dist internal/web/dist | |
| - name: Install cross-compiler (Linux ARM64) | |
| if: matrix.goarch == 'arm64' && matrix.goos == 'linux' | |
| run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Setup MinGW (Windows) | |
| if: matrix.goos == 'windows' | |
| uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2 | |
| with: | |
| msystem: MINGW64 | |
| update: false | |
| install: mingw-w64-x86_64-gcc | |
| path-type: inherit | |
| - name: Build | |
| shell: bash | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "1" | |
| CC: ${{ matrix.cc || '' }} | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| COMMIT=${GITHUB_SHA::8} | |
| BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| EXT="" | |
| if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi | |
| mkdir -p dist | |
| LDFLAGS="-s -w -X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.buildDate=${BUILD_DATE}" | |
| go build -tags fts5 -ldflags="$LDFLAGS" -trimpath \ | |
| -o dist/agentsview${EXT} ./cmd/agentsview | |
| cd dist | |
| if [ "$GOOS" = "windows" ]; then | |
| ARCHIVE="agentsview_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}.zip" | |
| 7z a "$ARCHIVE" agentsview${EXT} | |
| else | |
| ARCHIVE="agentsview_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" | |
| tar czf "$ARCHIVE" agentsview${EXT} | |
| fi | |
| rm agentsview${EXT} | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: agentsview-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: | | |
| dist/*.tar.gz | |
| dist/*.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| sha256sum *.tar.gz *.zip > SHA256SUMS | |
| cat SHA256SUMS | |
| - name: Get tag message | |
| id: tag_message | |
| run: | | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| TAG_TYPE=$(git cat-file -t "$TAG_NAME") | |
| if [ "$TAG_TYPE" != "tag" ]; then | |
| echo "Warning: $TAG_NAME is a lightweight tag, using auto-generated notes" | |
| echo "has_body=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| TAG_MSG=$(git tag -l --format='%(contents:body)' "$TAG_NAME") | |
| if [ -n "$TAG_MSG" ]; then | |
| DELIM="TAGMSG_$(date +%s%N)" | |
| echo "body<<$DELIM" >> $GITHUB_OUTPUT | |
| echo "$TAG_MSG" >> $GITHUB_OUTPUT | |
| echo "$DELIM" >> $GITHUB_OUTPUT | |
| echo "has_body=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_body=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 | |
| with: | |
| files: | | |
| artifacts/*.tar.gz | |
| artifacts/*.zip | |
| artifacts/SHA256SUMS | |
| body: ${{ steps.tag_message.outputs.has_body == 'true' && steps.tag_message.outputs.body || '' }} | |
| generate_release_notes: ${{ steps.tag_message.outputs.has_body != 'true' }} |