diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7eb91e..08105bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ on: default: false type: boolean Release: - description: 'Release check' + description: 'Release check (tmux)' default: false type: boolean Binary: @@ -33,10 +33,14 @@ on: default: false type: boolean +run-name: ${{ github.event.inputs.Distro }} [#${{ github.run_number }}] + jobs: build: runs-on: ${{ github.event.inputs.Distro }} + name: Run on ${{ github.event.inputs.Distro }} + steps: - name: Clone main repository uses: actions/checkout@v4 @@ -55,6 +59,15 @@ jobs: go mod verify go build -v ./... + - name: Get version + run: | + version=$(go run main.go -v) + echo "VERSION=$version" >> $GITHUB_ENV + echo "## Build Information" >> $GITHUB_STEP_SUMMARY + echo "- **OS**: ${{ github.event.inputs.Distro }}" >> $GITHUB_STEP_SUMMARY + echo "- **Version**: $version" >> $GITHUB_STEP_SUMMARY + echo "- **Build**: #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY + - name: Update dependencies if: ${{ github.event.inputs.Update == 'true' }} run: go get -u ./... @@ -169,17 +182,26 @@ jobs: continue-on-error: true # Release - - name: Install binary from latest release on GitHub + - name: Install binary from last commit on GitHub if: ${{ github.event.inputs.Release == 'true' }} - run: curl -sS https://raw.githubusercontent.com/Lifailon/lazyjournal/main/install.sh | bash + run: | + LAST_COMMIT_HASH=$(git ls-remote https://github.com/lifailon/lazyjournal HEAD | awk '{print $1}') + go install github.com/Lifailon/lazyjournal@$(LAST_COMMIT_HASH) - name: Check flags (cli mode) if: ${{ github.event.inputs.Release == 'true' }} run: | + echo -e "\n\033[32mVersion:\033[0m\n" lazyjournal -v + echo -e "\n\033[32mConfig:\033[0m\n" + lazyjournal -g + echo -e "\n\033[32mAudit:\033[0m\n" lazyjournal -a + echo -e "\n\033[32mColor:\033[0m\n" curl -s https://raw.githubusercontent.com/Lifailon/lazyjournal/refs/heads/main/color.log | lazyjournal -c + echo -e "\n\033[32mFuzzy:\033[0m\n" curl -s https://raw.githubusercontent.com/Lifailon/lazyjournal/refs/heads/main/color.log | lazyjournal -f "success" + echo -e "\n\033[32mRegex:\033[0m\n" curl -s https://raw.githubusercontent.com/Lifailon/lazyjournal/refs/heads/main/color.log | lazyjournal -r "http|127" - name: Check interface in TMUX @@ -218,17 +240,18 @@ jobs: - name: Build binaries if: ${{ github.event.inputs.Binary == 'true' }} run: | - version=$(go run main.go -v) - echo "VERSION=$version" >> $GITHUB_ENV - echo "Current version: $version" + version=$VERSION mkdir -p bin architectures=("amd64" "arm64") + oss=("linux" "darwin" "openbsd" "freebsd" "windows") for arch in "${architectures[@]}"; do - CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -o bin/lazyjournal-$version-linux-$arch - CGO_ENABLED=0 GOOS=darwin GOARCH=$arch go build -o bin/lazyjournal-$version-darwin-$arch - CGO_ENABLED=0 GOOS=openbsd GOARCH=$arch go build -o bin/lazyjournal-$version-openbsd-$arch - CGO_ENABLED=0 GOOS=freebsd GOARCH=$arch go build -o bin/lazyjournal-$version-freebsd-$arch - CGO_ENABLED=0 GOOS=windows GOARCH=$arch go build -o bin/lazyjournal-$version-windows-$arch.exe + for os in "${oss[@]}"; do + binName="bin/lazyjournal-$version-$os-$arch" + # Для Windows добавляем .exe + if [[ "$os" == "windows" ]]; then + binName="$binName.exe" + fi + CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -o "$binName" done ls -lh bin echo "ARTIFACT_NAME=lazyjournal-$version" >> $GITHUB_ENV