Skip to content

Commit

Permalink
refactor: change release process to use goreleaser for docker images too
Browse files Browse the repository at this point in the history
  • Loading branch information
rocktavious committed Aug 1, 2021
1 parent 66eb53c commit 1d1180e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 83 deletions.
40 changes: 8 additions & 32 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
# These secrets will need to be configured for the repository:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Login to Public ECR
uses: docker/login-action@v1
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand All @@ -33,35 +41,3 @@ jobs:
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
release-docker:
name: Release Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to Public ECR
uses: docker/login-action@v1
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
- name: Build & Push
run: |
git fetch --tags --force
TAG=$(git describe --tags --match "v[0-9].*" --always)
IMAGE="kubectl-opslevel:${TAG}"
docker build -t ${IMAGE} --build-arg VERSION=$(git describe --tags --long --abbrev=12 --match "v[0-9].*" --always) .
AWS_IMAGE="public.ecr.aws/e1n4f2i6/kubectl-opslevel:${TAG}"
docker tag ${IMAGE} ${AWS_IMAGE}
docker push ${AWS_IMAGE}
echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
GITHUB_IMAGE="docker.pkg.github.com/opslevel/kubectl-opslevel/main:${TAG}"
docker tag ${IMAGE} ${GITHUB_IMAGE}
docker push ${GITHUB_IMAGE}
22 changes: 0 additions & 22 deletions Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions skaffold.yaml

This file was deleted.

20 changes: 19 additions & 1 deletion src/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ archives:
format_overrides:
- goos: windows
format: zip
dockers:
- image_templates:
- "public.ecr.aws/opslevel/kubectl-opslevel:here{{ .Tag }}"
build_flag_templates:
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Tag }}"
- "--build-arg=VERSION={{ .Tag }}"
brews:
- name: kubectl
homepage: "https://www.opslevel.com/"
Expand All @@ -45,7 +53,17 @@ brews:
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
checksum:
name_template: '{{ .ProjectName }}.sha256'
name_template: '{{ .ProjectName }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
changelog:
skip: true
10 changes: 10 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:impish AS release
ENV USER_UID=1001 USER_NAME=opslevel
ENTRYPOINT ["/kubectl-opslevel"]
WORKDIR /app
RUN apt-get update && \
apt-get install -y curl && \
apt-get purge && apt-get clean && apt-get autoclean && \
curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \
chmod +x /usr/local/bin/jq
COPY kubectl-opslevel /

0 comments on commit 1d1180e

Please sign in to comment.