Skip to content

Commit

Permalink
migrate makefiles and CI/CD
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <[email protected]>
  • Loading branch information
inteon committed Nov 17, 2023
1 parent 21127a5 commit 515b85b
Show file tree
Hide file tree
Showing 74 changed files with 5,829 additions and 2,018 deletions.
5 changes: 0 additions & 5 deletions .dockerignore

This file was deleted.

100 changes: 60 additions & 40 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,78 @@ on:
push:
tags:
- "v*"

env:
VERSION: ${{ github.ref_name }}
IMAGE: quay.io/jetstack/cert-manager-approver-policy:${{ github.ref_name }}

jobs:
docker-image:
build_images:
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write
runs-on: ubuntu-22.04
contents: read # needed for checkout
packages: write # needed for push images
id-token: write # needed for keyless signing

steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: docker/build-push-action@v5

- uses: actions/setup-go@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
push: true
tags: ${{ env.IMAGE }}
build-args: |
VERSION=${{ env.VERSION }}
github-release:
runs-on: ubuntu-22.04
needs:
- docker-image
go-version-file: go.mod

- id: release
run: make release

- uses: actions/upload-artifact@v3
with:
name: trust-manager-${{ env.VERSION }}.tgz
path: ${{ steps.release.outputs.RELEASE_HELM_CHART_TAR }}

outputs:
RELEASE_OCI_MANAGER_IMAGE: ${{ steps.release.outputs.RELEASE_OCI_MANAGER_IMAGE }}
RELEASE_OCI_MANAGER_TAG: ${{ steps.release.outputs.RELEASE_OCI_MANAGER_TAG }}
RELEASE_HELM_CHART_NAME: ${{ steps.release.outputs.RELEASE_HELM_CHART_NAME }}
RELEASE_HELM_CHART_VERSION: ${{ steps.release.outputs.RELEASE_HELM_CHART_VERSION }}

github_release:
runs-on: ubuntu-latest

needs: build_images

permissions:
contents: write # needed for creating a PR
pull-requests: write # needed for creating a PR

steps:
- uses: actions/checkout@v4
- id: create_helm_archive
run: make helm-chart
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
touch .notes-file
echo "OCI_MANAGER_IMAGE: ${{ needs.build_images.outputs.RELEASE_OCI_MANAGER_IMAGE }}" >> .notes-file
echo "OCI_MANAGER_TAG: ${{ needs.build_images.outputs.RELEASE_OCI_MANAGER_TAG }}" >> .notes-file
echo "HELM_CHART_NAME: ${{ needs.build_images.outputs.RELEASE_HELM_CHART_NAME }}" >> .notes-file
echo "HELM_CHART_VERSION: ${{ needs.build_images.outputs.RELEASE_HELM_CHART_VERSION }}" >> .notes-file
- id: chart_download
uses: actions/download-artifact@v3
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: true
prerelease: true
body: |
Docker Image: `${{ env.IMAGE }}`
- uses: actions/upload-release-asset@v1
env:
name: trust-manager-${{ env.VERSION }}.tgz

- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.create_helm_archive.outputs.path }}
asset_name: cert-manager-approver-policy.helm-chart.tgz
asset_content_type: application/gzip
run: |
gh release create "$VERSION" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${VERSION#v}" \
--draft \
--verify-tag \
--notes-file .notes-file
gh release upload "$VERSION" \
--repo="$GITHUB_REPOSITORY" \
"${{ steps.chart_download.outputs.download-path }}/trust-manager-$VERSION.tgz"
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
_bin
bin
testbin/*

# Test binary, build with `go test -c`
*.test
Expand All @@ -15,17 +14,18 @@ bin
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.iml
*.swp
*.swo
*~

_bin
_certs
_artifacts
.vscode

/approver-policy
/_artifacts
# direnv files
.envrc
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

Please refer to the [cert-manager Contributing guide](https://cert-manager.io/docs/contributing/).
44 changes: 0 additions & 44 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 515b85b

Please sign in to comment.