From 6e3e4f27da5e7885b854128203e6cf181d4e5672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B1=BC=E7=AB=BF=E9=92=93=E9=B1=BC=E5=B9=B2?= <46661603+PokIsemaine@users.noreply.github.com> Date: Mon, 6 Feb 2023 20:31:48 +0800 Subject: [PATCH] feat: add semantic_release (#28) * feat: add semantic_release * feat: add semantic_release * fix: disable minikube's proxy --- .github/semantic.yml | 2 ++ .github/workflows/ci.yml | 18 ++++++++++++++++-- .releaserc.json | 16 ++++++++++++++++ e2e/pretest/env_setup.sh | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .github/semantic.yml create mode 100644 .releaserc.json diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000..605f6a7 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,2 @@ +# Always validate the PR title AND all the commits +titleAndCommits: true \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99ff5b1..8ccc80c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v2 with: @@ -26,7 +26,7 @@ jobs: e2e-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v2 with: @@ -37,3 +37,17 @@ jobs: run: cd e2e/pretest && ./env_setup.sh - name: run e2e test run: cd e2e && ./test.sh + + semantic-release: + name: Semantic Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Run semantic-release + if: github.repository == 'casbin/k8s-gatekeeper' && github.event_name == 'push' + run: | + npm install --save-dev semantic-release@17.2.4 + npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..7921c59 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,16 @@ +{ + "debug": true, + "branches": [ + "+([0-9])?(.{+([0-9]),x}).x", + "master", + { + "name": "beta", + "prerelease": true + } + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +} \ No newline at end of file diff --git a/e2e/pretest/env_setup.sh b/e2e/pretest/env_setup.sh index d1e2b1a..0efda1b 100755 --- a/e2e/pretest/env_setup.sh +++ b/e2e/pretest/env_setup.sh @@ -32,7 +32,7 @@ fi echo "[E2E PreTest] start minikube environment" minikube delete #minikube start -minikube start --image-mirror-country='cn' +minikube start