feat: move release to gha (#137)

This commit is contained in:
Jakub Błaszczyk 2023-10-26 15:32:50 +02:00 committed by GitHub
parent 35abbe3c5c
commit ede5d881eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 120 deletions

View File

@ -1,104 +0,0 @@
kube-builder: &install-kube-builder
golang_image: &golang_image
image: cimg/go:1.20
version: 2
jobs:
build:
docker:
- <<: *golang_image
steps:
- checkout
- run: make manager
test:
docker:
- <<: *golang_image
steps:
- checkout
- run: make test
test-integration:
machine: true
steps:
- checkout
- run:
name: Install dependencies
command: |
make deps
- run:
name: Run integration tests
command: make test-integration
release:
docker:
- <<: *golang_image
steps:
- checkout
- run:
command: |
echo 'export DOCKER_FULL_TAG=$(echo $CIRCLE_TAG | tr '+' '_')' >> $BASH_ENV
echo 'export DOCKER_SHORT_TAG=$(echo $CIRCLE_TAG | cut -d '+' -f1)' >> $BASH_ENV
./.circleci/release_name.bash
source $BASH_ENV
- setup_remote_docker
- run:
docker login --username "$DOCKER_USERNAME" --password
"$DOCKER_PASSWORD"
- run: curl -sL https://git.io/goreleaser | bash
release-changelog:
docker:
- image: circleci/ruby:2.5-node
steps:
- checkout
- run: gem install github_changelog_generator -v 1.14.3
- run: sudo npm i -g doctoc
- run:
github_changelog_generator -u ory -p hydra-maester -o CHANGELOG.md
--token $GITHUB_TOKEN
- run: doctoc CHANGELOG.md
- run: doctoc README.md
- run: git config --global user.email "circleci@ory.am"
- run: git config --global user.name "ORY Continuous Integration"
- run: git add CHANGELOG.md
- run: git add README.md
- run: |
git commit -a -m "docs: Incorporates changes from version $(git describe --tags)" || true
- run: git remote rm origin
- run:
git remote add origin
https://arekkas:$GITHUB_TOKEN@github.com/ory/hydra-maester.git
- run: git push origin HEAD:master || true
workflows:
version: 2
"test, build and release":
jobs:
- build:
filters:
tags:
only: /.*/
- test-integration:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- release:
requires:
- build
- test
- test-integration
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-changelog:
requires:
- release
filters:
tags:
only: /.*/
branches:
ignore: /.*/

View File

@ -1,13 +0,0 @@
#!/bin/bash
release=$(curl -s "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases")
tag=$(echo ${release} | jq -r ".[0].tag_name")
tag_name=$(echo ${release} | jq -r ".[0].name")
if [[ -n "$tag_name" ]]; then
echo "export RELEASE_NAME=$tag_name" >> $BASH_ENV
elif [[ -n "$tag" ]]; then
echo "export RELEASE_NAME=$tag" >> $BASH_ENV
else
echo "export RELEASE_NAME=$CIRCLE_SHA1" >> $BASH_ENV
fi

View File

@ -1,6 +1,5 @@
name: CI
on:
create:
push:
branches:
- "master"
@ -126,4 +125,32 @@ jobs:
- name: Checkout dependencies
uses: ./.github/actions/deps-setup
- name: Test
run: make test-integration
run: make docker-build
release:
if: ${{ github.ref_type == 'tag' }}
needs:
- test-build
- test-integration
- test-docker
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout dependencies
uses: ./.github/actions/deps-setup
- name: Set up Go
uses: actions/setup-go@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -126,7 +126,7 @@ manager: generate vet
# Build manager binary for CI
.PHONY: manager-ci
manager: generate vet
manager-ci: generate vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
# Run against the configured Kubernetes cluster in ~/.kube/config

View File

@ -75,6 +75,13 @@ To deploy the controller, edit the value of the `--hydra-url` argument in the
| **namespace** | no | Namespace in which the controller should operate. Setting this will make the controller ignore other namespaces. | `""` | `"my-namespace"` |
| **leader-elector-namespace** | no | Leader elector namespace where controller should be set. | `""` | `"my-namespace"` |
### Environmental Variables
| Variable name | Default value | Example value |
| :---------------------- | ------------------- | --------------------- |
| `**CLIENT_ID_KEY**` | `**CLIENT_ID**` | `**MY_SECRET_NAME**` |
| `**CLIENT_SECRET_KEY**` | `**CLIENT_SECRET**` | `**MY_SECRET_VALUE**` |
## Development
### Testing