Skip to content

Commit 72050ed

Browse files
authored
feat(ci): publish latest and nightly docker images (#12)
1 parent 8c69623 commit 72050ed

File tree

3 files changed

+62
-10
lines changed

3 files changed

+62
-10
lines changed

.github/workflows/cd.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,36 @@ on:
66
jobs:
77
cd:
88
runs-on: ubuntu-latest
9+
id: release
910
steps:
1011
- uses: actions/checkout@v2
1112
- uses: GoogleCloudPlatform/[email protected]
1213
with:
13-
token: ${{ secrets.JEFBOT_PAT }}
14+
token: ${{ secrets.GITHUB_TOKEN }}
1415
release-type: simple
1516
package-name: audit-org-keys
17+
- uses: actions/checkout@v2
18+
- name: get and set semver
19+
run: echo "::set-env name=SEMVER::$(echo version.txt)"
20+
- name: login into github package registry
21+
run: docker login "docker.pkg.github.com" -u "$GITHUB_ACTOR" -p "$GITHUB_TOKEN"
22+
- name: build nightly docker image
23+
if: ${{ ! steps.release.outputs.release_created }}
24+
run: |
25+
docker build \
26+
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:${GITHUB_SHA:0:7}" \
27+
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:nightly" \
28+
.
29+
- name: publish nightly
30+
if: ${{ ! steps.release.outputs.release_created }}
31+
run: docker push "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys"
32+
- name: build latest docker image
33+
if: ${{ steps.release.outputs.release_created }}
34+
run: |
35+
docker build \
36+
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:$SEMVER" \
37+
-t "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys:latest" \
38+
.
39+
- name: publish latest
40+
if: ${{ steps.release.outputs.release_created }}
41+
run: docker push "docker.pkg.github.com/${GITHUB_REPOSITORY}/audit-org-keys"

.github/workflows/ci.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@master
7+
- uses: actions/checkout@v2
88
- uses: actions/setup-go@v2
99
with:
1010
go-version: '1.14'
@@ -16,10 +16,16 @@ jobs:
1616
${{ runner.os }}-go-
1717
- name: Build
1818
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w"
19+
build-docker:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: build docker image
24+
run: docker build .
1925
lint:
2026
runs-on: ubuntu-latest
2127
steps:
22-
- uses: actions/checkout@master
28+
- uses: actions/checkout@v2
2329
- uses: actions/setup-go@v2
2430
with:
2531
go-version: '1.14'

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,31 @@ Programs like `ssh2john` from **John the Ripper** can best demonstrate how fast
66

77
## Getting started
88

9-
### Requirements
9+
### Releases
10+
11+
| Tag | Description |
12+
|:---:|---|
13+
| `latest` | Built against tagged releases; stable
14+
| `nightly` | Built against HEAD; generally considered stable, but could have problems |
15+
16+
```
17+
docker pull docker.pkg.github.com/jef/audit-org-keys/audit-org-keys:<tag>
18+
19+
docker run --rm -it \
20+
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
21+
--env "GITHUB_PAT=$GITHUB_PAT" \
22+
audit-org-keys:<tag>
23+
```
24+
25+
> :point_right: View [Available arguments](#available-arguments) and [Available environment variables](#available-environment-variables) below if you'd like to customize input and output
26+
27+
### Development
28+
29+
#### Requirements
1030

1131
- Go 1.14+ or Docker
1232

13-
### Running
33+
#### Running
1434

1535
```sh
1636
export GITHUB_ORGANIZATION=actions
@@ -24,25 +44,25 @@ go build
2444
./audit-org-keys -show-users=multiple
2545

2646
# Docker
27-
docker build -t audit-org-keys:local .
47+
docker build -t audit-org-keys:localhost .
2848

2949
docker run --rm -it \
3050
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
3151
--env "GITHUB_PAT=$GITHUB_PAT" \
32-
audit-org-keys:local
52+
audit-org-keys:localhost
3353

3454
# show users without keys
3555
docker run --rm -it \
3656
--env "GITHUB_ORGANIZATION=$GITHUB_ORGANIZATION" \
3757
--env "GITHUB_PAT=$GITHUB_PAT" \
38-
audit-org-keys:local -show-users=without
58+
audit-org-keys:localhost -show-users=without
3959
```
4060

41-
#### Available arguments
61+
##### Available arguments
4262

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

45-
#### Available environment variables
65+
##### Available environment variables
4666

4767
- `GITHUB_ORGANIZATION`*: The organization under audit
4868
- `GITHUB_PAT`*: GitHub Personal Access Token

0 commit comments

Comments
 (0)