diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml deleted file mode 100644 index ce1959c4..00000000 --- a/.github/workflows/changelog.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Changelog - -on: - push: - tags: - - v* - -env: - TZ: Asia/Shanghai - -jobs: - generate_changelog: - runs-on: ubuntu-latest - name: Generate changelog - steps: - - uses: actions/checkout@v3 - with: - ref: master - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: 1.20.x - - name: Cache Go Dependencies - uses: magnetikonline/action-golang-cache@v4 - with: - go-version-file: go.mod - - name: install task - run: | - echo "install task" - go install github.com/go-task/task/v3/cmd/task@latest - - name: Build docs - run: | - task godoc - - name: Publish docs - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GH_TOKEN }} - publish_dir: ./docs - - run: git fetch --prune --prune-tags - - run: git tag -l 'v*' - - run: ./hack/scripts/changelog.sh > CHANGELOG.md - - uses: peter-evans/create-pull-request@v5 - with: - title: 'docs: updated CHANGELOG.md & docs' - commit-message: 'docs: updated CHANGELOG.md & docs' - branch: create-pull-request/changelog - signoff: true - delete-branch: true diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2d2ad571..94813397 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,8 +5,7 @@ env: GO_VERSION: '1.20' TZ: Asia/Shanghai -permissions: - contents: read +permissions: write-all on: push: @@ -15,7 +14,7 @@ on: paths: - '**.go' - 'go.mod' - - '.github/workflows/go.yml' + - '.github/workflows/*.yml' pull_request: branches: - "*" @@ -110,3 +109,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Golang + uses: actions/setup-go@v4 + - name: Run Coverage + run: make coverage + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 5d6aaf8c..00000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Codecov" - -on: [push] - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Golang - uses: actions/setup-go@v4 - - name: Run Coverage - run: make coverage - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b94c4cf1..d6b2b3d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,7 @@ env: TZ: Asia/Shanghai GO_VERSION: '1.20' -permissions: - contents: write +permissions: write-all jobs: release: @@ -23,6 +22,14 @@ jobs: uses: actions/setup-go@v4 with: go-version: ${{ env.GO_VERSION }} + - name: install task + run: | + echo "install task" + go install github.com/go-task/task/v3/cmd/task@latest + - name: install upx + uses: crazy-max/ghaction-upx@v2 + with: + install-only: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: @@ -52,3 +59,47 @@ jobs: curl -F package=@$filename https://${FURY_TOKEN}@push.fury.io/qucheng/ curl -F package=@$filename https://${FURY_TOKEN}@push.fury.io/qucheng/ done + + Changelog: + name: "Changelog" + needs: release + timeout-minutes: 20 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: master + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + - name: install task + run: | + echo "install task" + go install github.com/go-task/task/v3/cmd/task@latest + - name: Build docs + run: | + task godoc + - name: Publish docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GH_TOKEN }} + publish_dir: ./docs + - run: git fetch --prune --prune-tags + - run: git tag -l 'v*' + - run: ./hack/scripts/changelog.sh > CHANGELOG.md + - name: fetch current version + id: get-current-tag + uses: actions-ecosystem/action-get-latest-tag@v1.6.0 + - uses: peter-evans/create-pull-request@v5 + with: + title: 'docs: updated CHANGELOG.md & docs for ${{steps.get-current-tag.outputs.tag }}' + commit-message: | + docs: updated CHANGELOG.md & docs + 🤖 add release changelog using rebot. + branch: create-pull-request/changelog-${{steps.get-current-tag.outputs.tag }} + delete-branch: true + labels: | + kind/doc + kind/bot diff --git a/.github/workflows/go.yml b/.github/workflows/test.yml similarity index 92% rename from .github/workflows/go.yml rename to .github/workflows/test.yml index 72b0487c..ab35f654 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,11 @@ -name: go +name: build for test env: # Common versions GO_VERSION: '1.20' TZ: Asia/Shanghai -permissions: - contents: read +permissions: write-all on: push: @@ -70,9 +69,9 @@ jobs: - uses: actions/checkout@v3 - name: "Download Binary" uses: actions/download-artifact@v3 - with: { name: qcadmin_linux_amd64, path: dist/artifacts/ } + with: { name: qcadmin_linux_amd64, path: dist } - name: test qcadmin - working-directory: dist/artifacts/ + working-directory: dist run: | chmod +x qcadmin_linux_amd64 sudo ./qcadmin_linux_amd64 cluster init --debug