Skip to content

Commit

Permalink
ci: refine the github actions code (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 authored Aug 20, 2024
1 parent ac307eb commit 01cfab8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"color": "B60205"
},
"CHECKS": {
"regexp": "^(feat|fix|test|refactor|chore|style|docs|perf|build|ci|revert)(\\(.*\\))?\\!?:.*",
"ignoreLabels": [
"ignore-title"
]
"regexp": "^(feat|fix|test|refactor|chore|style|docs|perf|build|ci|revert)(!)?(\\(.*\\))?:.*",
"ignoreLabels" : ["ignore-title"]
}
}
12 changes: 7 additions & 5 deletions .github/workflows/dev-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: GreptimeDB Operator Development Build
name: dev-build

on:
workflow_dispatch: # Allows you to run this workflow manually.
Expand All @@ -22,15 +22,17 @@ on:
required: false
default: GreptimeTeam/greptimedb-operator
commit: # Note: We only pull the source code and use the current workflow to build the artifacts.
description: The commit to build
required: true
description: The commit to build, default to the latest commit in the current branch.
required: false

env:
GO_VERSION: "1.21"

# The source code will check out in the following path: '${WORKING_DIR}/dev/greptimedb-operator'.
CHECKOUT_SOURCE_PATH: dev/greptimedb-operator

COMMIT: ${{ inputs.commit || github.sha }}

jobs:
docker:
name: build-images
Expand All @@ -45,7 +47,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.commit }}
ref: ${{ env.COMMIT }}
path: ${{ env.CHECKOUT_SOURCE_PATH }}

- name: Set up QEMU
Expand Down Expand Up @@ -80,7 +82,7 @@ jobs:
- name: Configure tag
shell: bash
run: |
VERSION="dev-$(date "+%Y%m%d-%s")-$(echo "${{ inputs.commit }}" | cut -c1-8)"
VERSION="dev-$(date "+%Y%m%d-%s")-$(echo "${{ env.COMMIT }}" | cut -c1-8)"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build and push operator
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml → .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI
name: develop

on:
pull_request:
Expand Down Expand Up @@ -55,14 +55,17 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: Check code generation
shell: bash
run: |
make check-code-generation
- name: Compile the project
shell: bash
run: |
make
- name: Make lint
shell: bash
run: |
make lint
Expand All @@ -79,6 +82,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: Run the unit tests
shell: bash
run: |
make test
Expand All @@ -96,5 +100,6 @@ jobs:

- name: Run e2e
id: e2e
shell: bash
run: |
make e2e
4 changes: 2 additions & 2 deletions .github/workflows/pr-title-checker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: PR Title Checker
name: check-pr-title

on:
pull_request_target:
Expand All @@ -27,7 +27,7 @@ jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: thehanimo/pr-title-checker@v1.3.4
- uses: thehanimo/pr-title-checker@v1.4.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release
name: release

on:
push:
Expand Down Expand Up @@ -63,7 +63,6 @@ jobs:
shell: bash
run: |
VERSION=${{ github.ref_name }}
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
- name: Build and push operator
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -106,7 +105,7 @@ jobs:
cp ./config/crd/resources/greptime.io_greptimedbstandalones.yaml ./greptimedbstandalones.yaml
- name: Publish release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ github.ref_name }}"
files: |
Expand Down

0 comments on commit 01cfab8

Please sign in to comment.