Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.binary }}
- run: echo "REPO_NAME=$(basename ${{ github.repository }})" >> "$GITHUB_ENV"
- name: Build and push ${{ matrix.binary }} container image
if: github.actor != 'dependabot[bot]'
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
Expand All @@ -47,4 +48,4 @@ jobs:
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
file: deploy/${{ matrix.binary }}/Dockerfile
context: dist/${{ matrix.binary }}_linux_amd64_v1
context: dist/${{ env.REPO_NAME }}_linux_amd64_v1
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
builds:
- main: ./cmd/go-cli-github
binary: go-cli-github
ldflags:
- >
-s -w
Expand Down
28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Go CLI Github
# Go CLI GitHub

[![Release](https://github.com/smlx/go-cli-github/actions/workflows/release.yaml/badge.svg)](https://github.com/smlx/go-cli-github/actions/workflows/release.yaml)
[![Coverage](https://coveralls.io/repos/github/smlx/go-cli-github/badge.svg?branch=main)](https://coveralls.io/github/smlx/go-cli-github?branch=main)
Expand Down Expand Up @@ -26,16 +26,16 @@ It also automatically builds and tests your code using [GitHub Actions](https://

## How to use

First set up the Github repo
First set up the GitHub repo

1. Create a new empty Github repository.
1. Create a new empty GitHub repository.

Then push some code to main:

1. Install [gonew](https://go.dev/blog/gonew) and run this command, replacing the last argument with the name of your new module:

```bash
gonew github.com/smlx/go-cli-github github.com/smlx/newproject
gonew github.com/smlx/go-cli-github@main github.com/smlx/newproject
```

1. Create the git repo and push to `main` (which will become the default branch):
Expand All @@ -46,7 +46,7 @@ Then push some code to main:
git branch -M main
git remote add origin git@github.com:smlx/newproject.git
git add .
git commit -a
git commit -am 'chore: create repository from template'
git push -u origin main
```

Expand All @@ -56,21 +56,21 @@ Then customize the code for your repository:

1. Update the code for your project:

* rename `cmd/go-cli-github` to `cmd/$YOUR_COMMAND`
* rename `deploy/go-cli-github` to `deploy/$YOUR_COMMAND`
* update `deploy/$YOUR_COMMAND/Dockerfile`
* rename `cmd/go-cli-github` to `cmd/$YOUR_COMMAND`
* update module in `cmd/$YOUR_COMMAND/*.go`, `internal/server/serve_test.go`
* update `.github/workflows/build.yaml`, replacing `go-cli-github` with `$YOUR_COMMAND`.
* update `.goreleaser.yml` to build `cmd/$YOUR_COMMAND`
* update the links at the top of the README
* update the `build`, `release`, and `tag-to-release` workflows, replacing `go-cli-github` with `$YOUR_COMMAND`.

1. Commit and push:

```bash
git commit -a
git add .
git commit -am 'chore: update template for new project'
git push -u origin setup
```
1. Open a PR, ensure all the actions are green, then merge the PR.
1. Open a PR, wait until all the checks go green, then merge the PR.

Configure the repository:

Expand All @@ -83,16 +83,8 @@ Configure the repository:

1. Go to repository Settings > Code security and analysis, and enable:

* Dependabot alerts
* Dependabot security updates
* Secret scanning
* Push protection
* Private vulnerability reporting

1. Go to repository Settings > Actions > General:

* Set Workflow permissions to "Read repository contents and package permissions"

1. Go to repository Settings > Rules > Rulesets, and import the `protect-default-branch.json` ruleset.

1. That's it.