diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 34a60d6..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Publish Docker -on: - push: - tags: - - "*" -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: flanksource/template-operator - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - tag_names: true - snapshot: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f33230f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Create Release +on: + push: + branches: + - main + - master + +jobs: + semantic-release: + runs-on: ubuntu-latest + outputs: + release-version: ${{ steps.semantic.outputs.release-version }} + new-release-published: ${{ steps.semantic.outputs.new-release-published }} + steps: + - uses: actions/checkout@v2 + - uses: codfish/semantic-release-action@v1 + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + operator: + needs: semantic-release + runs-on: ubuntu-latest + env: + VERSION: v${{ needs.semantic-release.outputs.release-version }} + steps: + - uses: actions/checkout@v2 + - name: Build operator + working-directory: ./config/default/ + run: | + kustomize edit set image flanksource/template-operator:v${{ needs.semantic-release.outputs.release-version }} + kustomize build . > operator.yml + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./config/default/operator.yml + tag: v${{ needs.semantic-release.outputs.release-version }} + asset_name: operator.yml + overwrite: true + + docker: + needs: semantic-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + env: + VERSION: v${{ needs.semantic-release.outputs.release-version }}" + with: + name: flanksource/template-operator + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + snapshot: true + tags: "latest,v${{ needs.semantic-release.outputs.release-version }}" \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29bc302..174b8cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,3 +21,12 @@ jobs: env: KUBERNETES_VERSION: ${{matrix.k8s}} run: ./test/e2e.sh + - name: Export logs + if: always() + run: kind --name kind-kind export logs ./logs + - name: Upload logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: log + path: ./logs diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..d3a7c01 --- /dev/null +++ b/.releaserc @@ -0,0 +1,21 @@ +plugins: + - - "@semantic-release/commit-analyzer" + - releaseRules: + - { type: doc, scope: README, release: patch } + - { type: fix, release: patch } + - { type: chore, release: patch } + - { type: refactor, release: patch } + - { type: feat, release: minor } + - { type: ci, release: false } + - { type: style, release: false } + parserOpts: + noteKeywords: + - MAJOR RELEASE + - "@semantic-release/release-notes-generator" + - - "@semantic-release/github" + - assets: + - path: ./config/default/operator.yml + name: operator.yml +branches: + - main + - master diff --git a/Makefile b/Makefile index 9621798..dfe5796 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ + + +ifeq ($(VERSION),) + VERSION_TAG=$(shell git describe --abbrev=0 --tags --exact-match 2>/dev/null || echo dev) +else + VERSION_TAG=$(VERSION) +endif + # Image URL to use all building/pushing image targets -IMG ?= flanksource/template-operator:v1 +IMG ?= flanksource/template-operator:${VERSION_TAG} # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=false" diff --git a/test/e2e.sh b/test/e2e.sh index 2fde63c..fe786b9 100755 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -2,7 +2,7 @@ set -e -export KARINA_VERSION=v0.49.0 +export KARINA_VERSION=v0.50.1 export KARINA="./karina -c test/config.yaml" export KUBECONFIG=~/.kube/config export DOCKER_API_VERSION=1.39