Skip to content

Commit

Permalink
feat(ci): publish latest and nightly docker images (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef committed Jun 29, 2020
1 parent 8c69623 commit 72050ed
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 10 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,36 @@ on:
jobs:
cd:
runs-on: ubuntu-latest
id: release
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/release-please-action@v1.3.2
with:
token: ${{ secrets.JEFBOT_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
package-name: audit-org-keys
- uses: actions/checkout@v2
- name: get and set semver
run: echo "::set-env name=SEMVER::$(echo version.txt)"
- name: login into github package registry
run: docker login "docker.pkg.github.com" -u "$GITHUB_ACTOR" -p "$GITHUB_TOKEN"
- name: build nightly docker image
if: ${{ ! steps.release.outputs.release_created }}
run: |
docker build \
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:${GITHUB_SHA:0:7}" \
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:nightly" \
.
- name: publish nightly
if: ${{ ! steps.release.outputs.release_created }}
run: docker push "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys"
- name: build latest docker image
if: ${{ steps.release.outputs.release_created }}
run: |
docker build \
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:$SEMVER" \
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:latest" \
.
- name: publish latest
if: ${{ steps.release.outputs.release_created }}
run: docker push "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys"
10 changes: 8 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14'
Expand All @@ -16,10 +16,16 @@ jobs:
${{ runner.os }}-go-
- name: Build
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w"
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build docker image
run: docker build .
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14'
Expand Down
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,31 @@ Programs like `ssh2john` from **John the Ripper** can best demonstrate how fast

## Getting started

### Requirements
### Releases

| Tag | Description |
|:---:|---|
| `latest` | Built against tagged releases; stable
| `nightly` | Built against HEAD; generally considered stable, but could have problems |

```
docker pull docker.pkg.github.com/jef/audit-org-keys/audit-org-keys:<tag>
docker run --rm -it \
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
--env "GITHUB_PAT=$GITHUB_PAT" \
audit-org-keys:<tag>
```

> :point_right: View [Available arguments](#available-arguments) and [Available environment variables](#available-environment-variables) below if you'd like to customize input and output
### Development

#### Requirements

- Go 1.14+ or Docker

### Running
#### Running

```sh
export GITHUB_ORGANIZATION=actions
Expand All @@ -24,25 +44,25 @@ go build
./audit-org-keys -show-users=multiple

# Docker
docker build -t audit-org-keys:local .
docker build -t audit-org-keys:localhost .

docker run --rm -it \
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
--env "GITHUB_PAT=$GITHUB_PAT" \
audit-org-keys:local
audit-org-keys:localhost

# show users without keys
docker run --rm -it \
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
--env "GITHUB_PAT=$GITHUB_PAT" \
audit-org-keys:local -show-users=without
audit-org-keys:localhost -show-users=without
```

#### Available arguments
##### Available arguments

- `-show-users=<filter>`: display users with filter (`all`, `with`, `without`, `multiple`)

#### Available environment variables
##### Available environment variables

- `GITHUB_ORGANIZATION`*: The organization under audit
- `GITHUB_PAT`*: GitHub Personal Access Token
Expand Down

0 comments on commit 72050ed

Please sign in to comment.