From 03fdee19ba0dd9e03134a090ceff5b54a61f9bbf Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Thu, 9 May 2024 15:42:08 +0800 Subject: [PATCH] chore: release ci (#4293) * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci * chore: release ci --- .github/workflows/manual-release.yml | 64 ++++++++++++++++++---------- .github/workflows/release.yml | 44 ++++++++++--------- release.sh | 4 +- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index 9f91f138ca..3895aa4941 100644 --- a/.github/workflows/manual-release.yml +++ b/.github/workflows/manual-release.yml @@ -4,30 +4,48 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -on: +on: workflow_dispatch: - inputs: - pr_number: - description: 'Please enter a pull request number' - required: true jobs: - build: + push-commit: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - run: gh pr checkout ${{ inputs.pr_number }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Commit files - run: | - yarn install - yarn version:alpha -y - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -a -m "Add changes" - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref }} + - name: Checkout + uses: actions/checkout@v3 + - name: Checkout pro-plugins + uses: actions/checkout@v4 + with: + repository: nocobase/pro-plugins + path: packages/pro-plugins + ssh-key: ${{ secrets.PRO_PLUGINS_DEPLOY_KEY }} + persist-credentials: true + - name: Set Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Run install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Run release.sh + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions Bot" + echo "packages/pro-plugins/" >> .git/info/exclude + bash release.sh + - name: push pro plugins + uses: ad-m/github-push-action@master + with: + ssh: true + branch: main + directory: packages/pro-plugins + repository: nocobase/pro-plugins + tags: true + atomic: true + - name: push + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.head_ref }} + tags: true + atomic: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34cfa004fc..ab5161f5a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,17 +14,20 @@ jobs: runs-on: ubuntu-latest container: node:18 steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: yarn install and build + - name: Checkout pro-plugins + uses: actions/checkout@v3 + with: + repository: nocobase/pro-plugins + path: packages/pro-plugins + ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} + - name: yarn install and build run: | yarn config set registry https://registry.npmjs.org/ yarn install yarn build - - - name: publish npmjs.org + - name: publish npmjs.org run: | git config --global user.email "test@mail.com" git config --global user.name "test" @@ -40,21 +43,26 @@ jobs: yarn config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} npm whoami yarn release:force --no-verify-access --no-git-reset --registry https://registry.npmjs.org/ + - name: publish pkg.nocobase.com + run: | + yarn config set //pkg.nocobase.com/:_authToken=${{ secrets.PKG_NOCOBASE_TOKEN }} + yarn release:force --no-verify-access --no-git-reset --registry https://pkg.nocobase.com + - name: publish pkg-src.nocobase.com + run: | + bash generate-npmignore.sh ignore-src + yarn config set //pkg-src.nocobase.com/:_authToken=${{ secrets.PKG_SRC_NOCOBASE_TOKEN }} + yarn release:force --no-verify-access --no-git-reset --registry https://pkg-src.nocobase.com push-docker: runs-on: ubuntu-latest needs: publish-npm steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - - name: Docker meta + - name: Docker meta id: meta uses: docker/metadata-action@v4 with: @@ -65,17 +73,15 @@ jobs: type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v3 with: context: ./docker/nocobase platforms: linux/amd64,linux/arm64 push: true - tags: nocobase/nocobase:latest,${{ steps.meta.outputs.tags }} \ No newline at end of file + tags: nocobase/nocobase:latest,${{ steps.meta.outputs.tags }} diff --git a/release.sh b/release.sh index 0e22fab7da..543592b5e5 100755 --- a/release.sh +++ b/release.sh @@ -3,7 +3,7 @@ cd ./packages/pro-plugins git add . git commit -m "chore(versions): 😊 publish v$(jq -r '.version' ../../lerna.json)" git tag v$(jq -r '.version' ../../lerna.json) -git push --atomic origin main v$(jq -r '.version' ../../lerna.json) +#git push --atomic origin main v$(jq -r '.version' ../../lerna.json) cd ../../ git add . git commit -m "chore(versions): 😊 publish v$(jq -r '.version' lerna.json)" @@ -11,4 +11,4 @@ git tag v$(jq -r '.version' lerna.json) yarn changelog --breaking-pattern "BREAKING CHANGE:" git add . git commit -m "chore: update changelog" -git push --atomic origin main v$(jq -r '.version' lerna.json) +#git push --atomic origin main v$(jq -r '.version' lerna.json)