Skip to content

Commit

Permalink
Merge branch 'main' into docs-audit_ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrian57 authored Nov 22, 2024
2 parents 1a21704 + 8f46e97 commit b117942
Show file tree
Hide file tree
Showing 1,545 changed files with 138,179 additions and 79,509 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
test:
strategy:
matrix:
go-version: [ 1.20.x, 1.21.x ]
go-version: [ 1.21.x, 1.22.x ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

runs-on: ${{ matrix.os }}
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -48,17 +48,9 @@ jobs:
# fetch-depth: 0 fetches all history for all branches and tags
fetch-depth: 0

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build snap
uses: snapcore/action-build@v1
id: build
run: |
make _build_snap && \
find doctl_v*.snap -exec echo "snap={}" >> "$GITHUB_OUTPUT" \;

- uses: snapcore/action-publish@master
env:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/snapcraft-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@ jobs:
# fetch-depth: 0 fetches all history for all branches and tags
fetch-depth: 0

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build snap
uses: snapcore/action-build@v1
id: build
run: |
make _build_snap && \
find doctl_v*.snap -exec echo "snap={}" >> "$GITHUB_OUTPUT" \;

- uses: snapcore/action-publish@master
env:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check spelling

on:
push:
branches: [ main ]
pull_request:
branches:
- main
- feature/**

jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4

- name: Check spelling
uses: crate-ci/[email protected]

4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project_name: doctl

version: 2
builds:
- main: ./cmd/doctl/main.go
env:
Expand Down Expand Up @@ -50,4 +50,4 @@ release:
name: doctl

changelog:
skip: false
disable: false
54 changes: 18 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
- [Build Scripts](#build-scripts)
- [Releasing](#releasing)
- [Tagging a release](#tagging-a-release)
- [Prerequisites](#prerequisites)
- [If a release fails](#if-a-release-fails)
- [Github Releases & Dockerhub](#github-releases--dockerhub)
- [Prerequisites](#prerequisites-1)
- [Snap](#snap)
- [Prerequisites](#prerequisites-2)
- [Building a new snap base image](#building-a-new-snap-base-image)
- [Snap](#snap)
- [Updating Homebrew](#updating-homebrew)

<!-- markdown-toc end -->
Expand Down Expand Up @@ -101,6 +95,11 @@ or `make help` for a list of available commands with descriptions.
- Avoid the passive voice ("When a tag is provided, access is granted") and use the active voice ("Entering a tag provides access")
- Be helpful when users have to enter a input that is from a list of possible values. Give examples, list the possible values inline (if the list is relatively short), or point them to a command that can list the possible values for them.

## Spell Check

`doctl` is setup to use the code aware spell checker called [typos](https://github.com/crate-ci/typos) to keep an eye on any spelling mistakes.

To install your own copy,follow the instructions on the [typos readme](https://github.com/crate-ci/typos?tab=readme-ov-file#install), and then run the `typos` binary

### Go environment

Expand Down Expand Up @@ -199,39 +198,22 @@ To cut a release, push a new tag (versioning discussed below).

### Tagging a release

##### Prerequisites

1. Run `make changes` to review the changes since the last
release. Based on the changes, decide what kind of release you are
doing (bugfix, feature or breaking).
`doctl` follows [semantic versioning](https://semver.org), ask if you aren't sure.

1. Tag the release using `BUMP=(bugfix|feature|breaking) make tag`.
(Bugfix, feature and breaking are aliases for semver's patch, minor and major.
BUMP will also accept `patch`, `minor` and `major`, if you prefer). The command
assumes you have a remote repository named `origin` pointing to this
repository. If you'd prefer to specify a different remote repository, you can
do so by setting `ORIGIN=(preferred remote name)`.

The new tag triggers the release.

##### Building a new snap base image

Occasionally, the snap build will break. When it does, it usually means that you need to update
the custom base image we use to build the snap. The Dockerfile for that image lives in
[dockerfiles/Dockerfile.snap](https://github.com/digitalocean/doctl/blob/main/dockerfiles/Dockerfile.snap).
The header of the Dockerfile has hints for updating the image, as well as instructions for building
the image using `make snap_image`. Once you've built the image, the snap_image target will provide
instructions for next steps.

### Updating Homebrew
1. Synchronize your local repository with all the tags that have been created or updated on the remote main branch
```bash
git checkout main
git pull --tags
```

Using the url and sha from the github release, update the
[homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/doctl.rb).
You can use `brew bump-formula-pr doctl`, or
1. Creates a new tag and push the tag to the remote repository named origin
```bash
git tag <new-tag> # Example: git tag v1.113.0
git push origin tag <new-tag> # Example: git push origin tag v1.113.0
```

1. fork `homebrew-core`
1. create a branch named `doctl-<version>`
1. update the url and the sha256 using the values for the archive in the github release
1. commit your changes
1. submit a PR to homebrew
To learn a bit more about how that all works, check out [goreleaser](https://goreleaser.com/intro)
and the config we use for it: [.goreleaser.yml](https://github.com/digitalocean/doctl/blob/main/.goreleaser.yml)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Step 1: Build
FROM golang:1.21-alpine AS build
FROM golang:1.22-alpine AS build

ARG GOARCH=amd64
ENV OUT_D /out
Expand Down
42 changes: 4 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,12 @@ gofmt_check:
check_focused:
@scripts/check_focused_test.sh

.PHONY: snap_image
snap_image:
@echo "==> build docker image for releasing snap"
@echo ""
@scripts/snap_image.sh

.PHONY: _snap_image_version
_snap_image_version:
@ORIGIN=${ORIGIN} SNAP_IMAGE=true scripts/version.sh

.PHONY: build_local_snap
build_local_snap:
@echo "==> build local snap using local image tagged doctl-snap-base"
@echo ""
@BUILD=local_snap scripts/snap_image.sh

.PHONY: prerelease_snap_image
prerelease_snap_image:
@echo "==> tag doctl-snap-base as a prerelease and push to dockerhub as latest"
@echo ""
@BUILD=pre scripts/snap_image.sh

.PHONY: finalize_snap_image
finalize_snap_image:
@echo "==> tag latest with most recent doctl version push to dockerhub"
@echo ""
@ORIGIN=${ORIGIN} BUILD=finalize scripts/snap_image.sh

CHANNEL ?= stable

.PHONY: _build_snap
_build_snap:
@CHANNEL=${CHANNEL} scripts/_build_snap.sh

.PHONY: snap
snap:
@echo "==> publish snap (normally done by travis)"
snap: clean
@echo "==> building snap"
@echo ""
@CHANNEL=${CHANNEL} scripts/snap.sh
@snapcraft

.PHONY: mocks
mocks:
Expand Down Expand Up @@ -193,7 +160,7 @@ clean:

.PHONY: _install_github_release_notes
_install_github_release_notes:
@GO111MODULE=off go get -u github.com/digitalocean/github-changelog-generator
go install github.com/digitalocean/github-changelog-generator@latest

.PHONY: _changelog
_changelog: _install_github_release_notes
Expand Down Expand Up @@ -234,7 +201,6 @@ _tag_and_release: tag
@echo "=> DEPRECATED: BUMP=${BUMP} tag and release"
@echo ""
@$(MAKE) _release
@$(MAKE) snap

.PHONY: release
release:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</p>

<p align="center">
<a href="https://travis-ci.org/digitalocean/doctl">
<img src="https://travis-ci.org/digitalocean/doctl.svg?branch=main" alt="Build Status" />
<a href="https://github.com/digitalocean/doctl/actions/workflows/ci.yml">
<img src="https://github.com/digitalocean/doctl/actions/workflows/ci.yml/badge.svg" alt="Build Status" />
</a>
<a href="https://godoc.org/github.com/digitalocean/doctl">
<img src="https://godoc.org/github.com/digitalocean/doctl?status.svg" alt="GoDoc" />
Expand Down
16 changes: 16 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[files]
extend-exclude = [
"vendor/**",
"go.mod"
]

[default.extend-identifiers]
vas = "vas"
splitted = "splitted"

[default.extend-words]
# Its not perfect at hashes yet
cace = "cace"
Wqs = "Wqs"
# example and exmaple as two domain examples
exmaple = "exmaple"
Loading

0 comments on commit b117942

Please sign in to comment.