Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Github Actions / Github Packages #140

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
108 changes: 0 additions & 108 deletions .circleci/config.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-push
on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: test
run: make docker-test

- name: build
run: make docker-build

- name: Log in to GHCR
run: |
echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: publish-latest
run: |
docker tag contentful-labs/kube-secret-syncer:latest ghcr.io/contentful-labs/kube-secret-syncer:latest
docker push ghcr.io/contentful-labs/kube-secret-syncer:latest
if: github.ref == 'refs/heads/master'

- name: publish-branch
run: |
docker tag contentful-labs/kube-secret-syncer:latest ghcr.io/contentful-labs/kube-secret-syncer:${GITHUB_REF##*/}
docker push ghcr.io/contentful-labs/kube-secret-syncer:${GITHUB_REF##*/}
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/master'

- name: publish-tag
run: |
docker tag contentful-labs/kube-secret-syncer:latest ghcr.io/contentful-labs/kube-secret-syncer:${GITHUB_REF##*/}
docker push ghcr.io/contentful-labs/kube-secret-syncer:${GITHUB_REF##*/}
if: startsWith(github.ref, 'refs/tags/v')
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ generate: controller-gen
# Run tests in a container
docker-test:
docker build . -t ${IMG}-test --target=test
docker run -it -v $(PWD):/repo --rm ${IMG}-test go test -v ./... -coverprofile /repo/cover.out -coverpkg ./controllers/...,./pkg/...
docker run -t -v $(PWD):/repo --rm ${IMG}-test go test -v ./... -coverprofile /repo/cover.out -coverpkg ./controllers/...,./pkg/...

# Build the docker image
docker-build:
Expand Down