diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ee32663 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +on: + push: + tags: + - "v*" +jobs: + image: + name: Push container image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: docker/metadata-action@v4 + id: meta + with: + images: ghcr.io/${{ github.repository_owner }}/gitbackup-controller + tags: | + type=semver,pattern=v{{version}} + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + release: + name: Release on GitHub + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: go.mod + - run: REGISTRY=ghcr.io/${{ github.repository_owner }} ./hack/dist-manifests.sh + - uses: softprops/action-gh-release@v1 + with: + files: gitbackup.yaml diff --git a/README.md b/README.md index 11a278a..8ad2692 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,7 @@ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/ 2. Install the controller with the following command. It creates `gitbackup-system` namespace and deploys CRDs, controllers and other resources. ```sh -# TODO(user) -kubectl apply -f https://... +kubectl apply -f https://github.com/ebiiim/gitbackup/releases/download/v0.1.0/gitbackup.yaml ``` ### Deploy a `Repository` resource @@ -103,8 +102,7 @@ kubectl delete --all repos -A 2. Delete the Operator. ```sh -# TODO(user) -kubectl delete -f https://... +kubectl apply -f https://github.com/ebiiim/gitbackup/releases/download/v0.1.0/gitbackup.yaml ``` ## Developing diff --git a/hack/dist-manifests.sh b/hack/dist-manifests.sh index 7b376e3..5b2fe30 100755 --- a/hack/dist-manifests.sh +++ b/hack/dist-manifests.sh @@ -9,10 +9,13 @@ PROJECT_ROOT=$(dirname "$(dirname "$SCRIPT")") PROJECT_NAME=$(basename "$PROJECT_ROOT") VERSION=$(git describe --tags --match "v*") -IMG=$PROJECT_NAME-controller:$VERSION +REGISTRY=${REGISTRY:-"localhost"} +IMG=$REGISTRY/$PROJECT_NAME-controller:$VERSION DIST_FILE=gitbackup.yaml cd "$PROJECT_ROOT" +make kustomize + cd config/manager && "$PROJECT_ROOT/bin/kustomize" edit set image controller="$IMG" cd "$PROJECT_ROOT" && "$PROJECT_ROOT/bin/kustomize" build config/default > $DIST_FILE