fix(cli): improve devices empty states #33
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: Snapshot release | |
| on: | |
| push: | |
| branches: | |
| - trunk | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish-linux-cli: | |
| name: Build and publish Linux CLI snapshot | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build Linux CLI | |
| run: | | |
| set -euo pipefail | |
| short_sha="${GITHUB_SHA::7}" | |
| version="$(./tools/git-version.sh)" | |
| mkdir -p dist | |
| GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w -X main.version=${version}" -o "dist/adb-go-linux-x64" ./cmd/adb-go | |
| chmod +x "dist/adb-go-linux-x64" | |
| echo "binary=dist/adb-go-linux-x64" >> "$GITHUB_ENV" | |
| - name: Move snapshot tag | |
| run: | | |
| set -euo pipefail | |
| git tag -f snapshot "$GITHUB_SHA" | |
| git push --force origin refs/tags/snapshot | |
| - name: Create or update snapshot release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| if gh release view snapshot >/dev/null 2>&1; then | |
| gh release edit snapshot --title snapshot --prerelease --latest=false | |
| else | |
| gh release create snapshot --title snapshot --notes "Automated Linux CLI snapshot build." --prerelease --latest=false | |
| fi | |
| old_assets="$(gh release view snapshot --json assets --jq '.assets[].name' | grep -E '^(adbgo-|adb-go-linux-x64$)' || true)" | |
| if [ -n "$old_assets" ]; then | |
| while IFS= read -r asset; do | |
| gh release delete-asset snapshot "$asset" --yes | |
| done <<< "$old_assets" | |
| fi | |
| gh release upload snapshot "$binary" --clobber |