From 3d7ae65ad9790040e4f21609d204ea958a927616 Mon Sep 17 00:00:00 2001 From: Andrey Markelov Date: Mon, 15 Jun 2026 14:52:28 -0700 Subject: [PATCH] Add GitHub Actions CI, release, and Pages workflows, remove Travis CI Add CI workflow (vet, test, cross-compile) that runs on pushes to master and PRs. Add release workflow that builds binaries and attaches them to GitHub Releases on tag push. Add Pages workflow that deploys README.md to gh-pages on master push. Remove .travis.yml (travis-ci.org is defunct). Update build.sh: drop gox and dead secret ldflags, add arm64 targets. Update README badge to GitHub Actions and modernize build instructions. --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++++++ .github/workflows/pages.yml | 34 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 25 +++++++++++++++++++++++ .travis.yml | 22 -------------------- README.md | 26 ++++++++++++++---------- build.sh | 29 +++++++++++++++++--------- 6 files changed, 131 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pages.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f729599 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: "1.25" + - run: go vet ./... + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: "1.25" + - run: go test ./... + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: "1.25" + - run: ./build.sh diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..cf723e0 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,34 @@ +name: Deploy Pages + +on: + push: + branches: [master] + paths: + - README.md + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + + - name: Prepare site content + run: | + mkdir -p site + cp README.md site/index.md + cat > site/_config.yml << 'EOF' + title: dbxcli + description: A command line client for Dropbox built using the Go SDK + show_downloads: false + theme: jekyll-theme-hacker + plugins: + - jekyll-mentions + EOF + + - uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: site + clean-exclude: images diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..61feeea --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: "1.25" + - run: go vet ./... + - run: go test ./... + - run: ./build.sh + env: + TRAVIS_TAG: ${{ github.ref_name }} + - uses: softprops/action-gh-release@v3 + with: + files: dist/* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae55811..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go - -go: - - "1.11.x" - -before_script: - - go get -u github.com/mitchellh/gox - - env GO111MODULE=on go vet ./... - -install: true - -script: - - ./build.sh - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - skip_cleanup: true - file_glob: true - file: "dist/*" - on: - tags: true diff --git a/README.md b/README.md index 2c29742..ce0db61 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # `dbxcli`: A command line tool for Dropbox users and team admins [UNOFFICIAL] -[![Build Status](https://travis-ci.org/dropbox/dbxcli.svg?branch=master)](https://travis-ci.org/dropbox/dbxcli) +[![CI](https://github.com/dropbox/dbxcli/actions/workflows/ci.yml/badge.svg)](https://github.com/dropbox/dbxcli/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/dropbox/dbxcli)](https://goreportcard.com/report/github.com/dropbox/dbxcli) :warning: WARNING: This project is **NOT official**. What does this mean? @@ -47,21 +47,25 @@ $ chmod +x dbxcli ``` ### Instructions for building yourself -For newcomers the go build process can be a bit arcane, these steps can be followed to build `dbxcli` yourself. -1. Make sure `git`, `go`, and `gox` are installed. -2. Create a Go folder. For example, `mkdir $HOME/go` or `mkdir $HOME/.go`. Navigate to it. -3. `go get github.com/dropbox/dbxcli`. That's right, you don't manually clone it, this does it for you. -4. `cd ~/go/src/github.com/dropbox/dbxcli` (adapt accordingly based on step 2). +1. Make sure `git` and `go` are installed. +2. Install the latest released version: + ```sh + $ go install github.com/dropbox/dbxcli@latest + ``` +3. Or build from source: + ```sh + $ git clone https://github.com/dropbox/dbxcli.git + $ cd dbxcli + $ go build . + ``` + +To use your own Dropbox app while developing, provide its app key when logging in: -To use your own Dropbox app while developing, provide its app key when running -`dbxcli`: ```sh -$ export DROPBOX_PERSONAL_APP_KEY=your-app-key +$ dbxcli login --app-key=your-app-key ``` -Finally we're ready to build. Run `go build`, and you'll see a `dbxcli` binary has been created in the current directory. Congrats, we're done! - ## Usage `dbxcli` is largely self documenting. Run `dbxcli -h` for a list of supported commands: diff --git a/build.sh b/build.sh index bd26171..28f8168 100755 --- a/build.sh +++ b/build.sh @@ -1,12 +1,21 @@ #!/bin/bash -LDFLAGS="-s -w -X main.version=${TRAVIS_TAG:-TRAVIS_COMMIT}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppKey=${PERSONAL_KEY}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppSecret=${PERSONAL_SECRET}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppKey=${ACCESS_KEY}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppSecret=${ACCESS_SECRET}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppKey=${MANAGE_KEY}" -LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppSecret=${MANAGE_SECRET}" -GO111MODULE=on gox -ldflags="${LDFLAGS}" \ - -osarch="darwin/amd64 linux/amd64 windows/amd64 linux/arm openbsd/amd64" \ - -output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}" +set -e + +VERSION="${TRAVIS_TAG:-${GITHUB_REF_NAME:-dev}}" +LDFLAGS="-s -w -X main.version=${VERSION}" + +TARGETS="darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm openbsd/amd64 windows/amd64" + +mkdir -p dist + +for target in $TARGETS; do + GOOS="${target%/*}" + GOARCH="${target#*/}" + output="dist/dbxcli-${GOOS}-${GOARCH}" + if [ "$GOOS" = "windows" ]; then + output="${output}.exe" + fi + echo "Building ${target}..." + GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="${LDFLAGS}" -o "$output" . +done