Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #358

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Dev #358

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Deploy Dev

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run Snyk to check Docker image for vulnerabilities
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: ghcr.io/lordoverlord/ctop:dev
command: monitor
50 changes: 50 additions & 0 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Deploy Master

on:
push:
branches: [ amster ]
pull_request:
branches: [ master ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run Snyk to check Docker image for vulnerabilities
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: ghcr.io/lordoverlord/ctop:master
command: monitor
114 changes: 114 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build and Release ctop for dev

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18 # Specify the Go version you want to use

- name: Tidy up Go modules and get missing dependencies
run: |
go mod tidy # Clean up and download necessary dependencies

- name: Build binary for amd64
run: |
GOOS=linux GOARCH=amd64 go build -o ctop-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o ctop-darwin-amd64
GOOS=windows GOARCH=amd64 go build -o ctop-windows-amd64

- name: Get latest version tag
id: get_latest_tag
run: |
# Fetch tags and find the latest one
git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag is $LATEST_TAG"
# Set output for later steps
echo "::set-output name=latest_tag::$LATEST_TAG"

- name: Increment version tag
id: increment_tag
run: |
LATEST_TAG=${{ steps.get_latest_tag.outputs.latest_tag }}
# Check if the latest tag is in the vX.Y.Z format
if [[ "$LATEST_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Extract the major, minor, and patch components of the version
VERSION=$(echo $LATEST_TAG | grep -oP 'v\K\d+\.\d+\.\d+')
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Increment the patch version
PATCH=$((PATCH + 1))
NEW_TAG="v$MAJOR.$MINOR.$PATCH"
else
# If the latest tag is not in vX.Y.Z format, start at v0.1.0
echo "No valid version tag found. Starting at v0.1.0"
NEW_TAG="v0.1.0"
fi
echo "New version tag is $NEW_TAG"
# Set the new tag output for later steps
echo "::set-output name=new_tag::$NEW_TAG"

- name: Create new tag
run: |
NEW_TAG=${{ steps.increment_tag.outputs.new_tag }}
echo "Creating new tag: $NEW_TAG"
git config user.name "github-actions"
git config user.email "[email protected]"
git tag $NEW_TAG
git push origin $NEW_TAG

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.increment_tag.outputs.new_tag }}
release_name: Release ${{ steps.increment_tag.outputs.new_tag }}
draft: false
prerelease: true # Mark this as a pre-release since it's dev

# Upload the Linux binary
- name: Upload Linux amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output from the release step
asset_path: ./ctop-linux-amd64
asset_name: ctop-linux-amd64
asset_content_type: application/octet-stream

# Upload the macOS binary
- name: Upload Darwin amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output
asset_path: ./ctop-darwin-amd64
asset_name: ctop-darwin-amd64
asset_content_type: application/octet-stream

# Upload the Windows binary
- name: Upload Windows amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output
asset_path: ./ctop-windows-amd64
asset_name: ctop-windows-amd64
asset_content_type: application/octet-stream
114 changes: 114 additions & 0 deletions .github/workflows/release-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build and Release ctop for master

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18 # Specify the Go version you want to use

- name: Tidy up Go modules and get missing dependencies
run: |
go mod tidy # Clean up and download necessary dependencies

- name: Build binary for amd64
run: |
GOOS=linux GOARCH=amd64 go build -o ctop-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o ctop-darwin-amd64
GOOS=windows GOARCH=amd64 go build -o ctop-windows-amd64

- name: Get latest version tag
id: get_latest_tag
run: |
# Fetch tags and find the latest one
git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag is $LATEST_TAG"
# Set output for later steps
echo "::set-output name=latest_tag::$LATEST_TAG"

- name: Increment version tag
id: increment_tag
run: |
LATEST_TAG=${{ steps.get_latest_tag.outputs.latest_tag }}
# Check if the latest tag is in the vX.Y.Z format
if [[ "$LATEST_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Extract the major, minor, and patch components of the version
VERSION=$(echo $LATEST_TAG | grep -oP 'v\K\d+\.\d+\.\d+')
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Increment the patch version
PATCH=$((PATCH + 1))
NEW_TAG="v$MAJOR.$MINOR.$PATCH"
else
# If the latest tag is not in vX.Y.Z format, start at v0.1.0
echo "No valid version tag found. Starting at v0.1.0"
NEW_TAG="v0.1.0"
fi
echo "New version tag is $NEW_TAG"
# Set the new tag output for later steps
echo "::set-output name=new_tag::$NEW_TAG"

- name: Create new tag
run: |
NEW_TAG=${{ steps.increment_tag.outputs.new_tag }}
echo "Creating new tag: $NEW_TAG"
git config user.name "github-actions"
git config user.email "[email protected]"
git tag $NEW_TAG
git push origin $NEW_TAG

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.increment_tag.outputs.new_tag }}
release_name: Release ${{ steps.increment_tag.outputs.new_tag }}
draft: false
prerelease: true # Mark this as a pre-release since it's dev

# Upload the Linux binary
- name: Upload Linux amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output from the release step
asset_path: ./ctop-linux-amd64
asset_name: ctop-linux-amd64
asset_content_type: application/octet-stream

# Upload the macOS binary
- name: Upload Darwin amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output
asset_path: ./ctop-darwin-amd64
asset_name: ctop-darwin-amd64
asset_content_type: application/octet-stream

# Upload the Windows binary
- name: Upload Windows amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL output
asset_path: ./ctop-windows-amd64
asset_name: ctop-windows-amd64
asset_content_type: application/octet-stream
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ as well as a [single container view][single_view] for inspecting a specific cont

## Install

Fetch the [latest release](https://github.com/bcicen/ctop/releases) for your platform:
Fetch the [latest release](https://github.com/lordoverlord/ctop/releases) for your platform:

#### Debian/Ubuntu

Expand All @@ -42,7 +42,7 @@ _`ctop` is also available for Arch in the [AUR](https://aur.archlinux.org/packag
#### Linux (Generic)

```bash
sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop
sudo wget https://github.com/lordoverlord/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop
sudo chmod +x /usr/local/bin/ctop
```

Expand All @@ -57,7 +57,7 @@ sudo port install ctop
```
or
```bash
sudo curl -Lo /usr/local/bin/ctop https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-darwin-amd64
sudo curl -Lo /usr/local/bin/ctop https://github.com/lordoverlord/ctop/releases/download/v0.7.7/ctop-0.7.7-darwin-amd64
sudo chmod +x /usr/local/bin/ctop
```

Expand Down Expand Up @@ -125,7 +125,7 @@ Option | Description
[build]: _docs/build.md
[connectors]: _docs/connectors.md
[single_view]: _docs/single.md
[release]: https://img.shields.io/github/release/bcicen/ctop.svg "ctop"
[release]: https://img.shields.io/github/release/lordoverlord/ctop.svg "ctop"
[homebrew]: https://img.shields.io/homebrew/v/ctop.svg "ctop"
[macports]: https://repology.org/badge/version-for-repo/macports/ctop.svg?header=macports "ctop"
[scoop]: https://img.shields.io/scoop/v/ctop?bucket=main "ctop"
Expand Down
2 changes: 1 addition & 1 deletion config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"sync"

"github.com/bcicen/ctop/logging"
"github.com/lordoverlord/ctop/logging"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion connector/collector/docker.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package collector

import (
"github.com/bcicen/ctop/models"
"github.com/lordoverlord/ctop/models"
api "github.com/fsouza/go-dockerclient"
)

Expand Down
2 changes: 1 addition & 1 deletion connector/collector/docker_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/bcicen/ctop/models"
"github.com/lordoverlord/ctop/models"
api "github.com/fsouza/go-dockerclient"
)

Expand Down
Loading