diff --git a/.github/workflows/docker-community.yml b/.github/workflows/docker-community.yml deleted file mode 100644 index a56fa363e0..0000000000 --- a/.github/workflows/docker-community.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Docker Community - -on: - workflow_run: - workflows: [Release NPM] - types: - - completed - push: - branches: - - 'release/**' - -jobs: - docker: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - strategy: - matrix: - node-version: [14.x] - steps: - # checkout branch 2.7 - - name: Checkout branch 2.7 - uses: actions/checkout@v2 - with: - ref: '2.7' - - # checkout branch 2.6 - # - name: Checkout branch 2.6 - # uses: actions/checkout@v2 - # if: ${{ startsWith(steps.branch-name.outputs.tag, '2.7') }} - # with: - # ref: '2.6' - - - name: Set Current Version - run: | - STEEDOS_VERSION=$(node -p 'require("./lerna.json").version') - echo "STEEDOS_VERSION=${STEEDOS_VERSION}" >> $GITHUB_ENV - echo "STEEDOS_VERSION=${STEEDOS_VERSION}" - - - name: Generate info.json - run: | - if [[ -f deploy/community/scripts/generate_info_json.sh ]]; then - deploy/community/scripts/generate_info_json.sh - fi - - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - with: - driver-opts: network=host - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - steedos/steedos-community - 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn/dockerhub/steedos/steedos-community - tags: | - type=semver,pattern={{version}},value=${{ env.STEEDOS_VERSION }} - type=semver,pattern={{major}}.{{minor}},value=${{ env.STEEDOS_VERSION }} - type=semver,pattern={{major}},value=${{ env.STEEDOS_VERSION }} - - - uses: docker/login-action@v1 - name: Login Docker Hub - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_NINGXIA }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_NINGXIA }} - aws-region: cn-northwest-1 - - - name: Login to ECR - uses: docker/login-action@v2 - with: - registry: 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn - - - name: Replace Version ~2.7 to Tag - uses: jacobtomlinson/gha-find-replace@v2 - with: - include: deploy/community/app/platform/package.json - find: "~2.7" - replace: ${{env.STEEDOS_VERSION}} - regex: false - - - name: Build and push docker - uses: docker/build-push-action@v3 - with: - context: ./deploy/community - platforms: linux/amd64 #,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/docker-enterprise.yml b/.github/workflows/docker-enterprise.yml deleted file mode 100644 index 3ccf4e9a02..0000000000 --- a/.github/workflows/docker-enterprise.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Docker Enterprise - -on: - workflow_run: - workflows: [Release NPM] - types: - - completed - push: - branches: - - 'release/**' - -jobs: - docker: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - steps: - # checkout branch 2.7 - - name: Checkout branch 2.7 - uses: actions/checkout@v2 - with: - ref: '2.7' - - # checkout branch 2.6 - # - name: Checkout branch 2.6 - # uses: actions/checkout@v2 - # with: - # ref: '2.6' - - - name: Set Current Version - run: | - STEEDOS_VERSION=$(node -p 'require("./lerna.json").version') - echo "STEEDOS_VERSION=${STEEDOS_VERSION}" >> $GITHUB_ENV - echo "STEEDOS_VERSION=${STEEDOS_VERSION}" - - - name: Generate info.json - run: | - if [[ -f deploy/enterprise/scripts/generate_info_json.sh ]]; then - deploy/enterprise/scripts/generate_info_json.sh - fi - - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - with: - driver-opts: network=host - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - steedos/steedos-enterprise - 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn/dockerhub/steedos/steedos-enterprise - tags: | - type=semver,pattern={{version}},value=${{ env.STEEDOS_VERSION }} - type=semver,pattern={{major}}.{{minor}},value=${{ env.STEEDOS_VERSION }} - type=semver,pattern={{major}},value=${{ env.STEEDOS_VERSION }} - - - uses: docker/login-action@v1 - name: Login Docker Hub - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_NINGXIA }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_NINGXIA }} - aws-region: cn-northwest-1 - - - name: Login to ECR - uses: docker/login-action@v2 - with: - registry: 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn - - - name: Replace Version ~2.7 to Tag - uses: jacobtomlinson/gha-find-replace@v2 - with: - include: deploy/enterprise/app/platform/package.json - find: "~2.7" - replace: ${{env.STEEDOS_VERSION}} - regex: false - - - name: Build and push docker - uses: docker/build-push-action@v3 - if: ${{ steps.version.outputs.is_stable != 'true' }} - with: - context: ./deploy/enterprise - platforms: linux/amd64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - # 正式版才发布 arm64 - - name: Build and push docker - uses: docker/build-push-action@v3 - if: ${{ steps.version.outputs.is_stable == 'true' }} - with: - context: ./deploy/enterprise - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index 244cd92bea..d593b2ff84 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -5,7 +5,7 @@ on: tags: - 'v**' jobs: - docker: + npm-release: runs-on: ubuntu-latest strategy: matrix: @@ -245,3 +245,234 @@ jobs: # release_name: Release v${{ steps.branch-name.outputs.tag }} # draft: false # prerelease: false + docker-community: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + strategy: + matrix: + node-version: [14.x] + steps: + - uses: nowsprinting/check-version-format-action@v3 + id: version + with: + prefix: 'v' + + - name: Check valid tag format + if: steps.version.outputs.is_valid == 'false' + run: exit 1 + + - name: Get branch names + id: branch-name + uses: tj-actions/branch-names@v5.2 + with: + strip_tag_prefix: v + + - name: Get the current tag + if: steps.branch-name.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/') + run: | + echo "tag: ${{ steps.branch-name.outputs.tag }}" + echo "current_branch: ${{ steps.branch-name.outputs.current_branch }}" + echo "ref_branch: ${{ steps.branch-name.outputs.ref_branch }}" + + - name: Check valid branch + if: ${{ !startsWith(steps.branch-name.outputs.tag, '2.') }} + run: exit 1 + + # checkout branch 2.7 + - name: Checkout branch 2.7 + uses: actions/checkout@v2 + if: ${{ startsWith(steps.branch-name.outputs.tag, '2.7') }} + with: + ref: '2.7' + + # checkout branch 2.6 + - name: Checkout branch 2.6 + uses: actions/checkout@v2 + if: ${{ startsWith(steps.branch-name.outputs.tag, '2.6') }} + with: + ref: '2.6' + + - name: Set Current Version + run: | + STEEDOS_VERSION=$(node -p 'require("./lerna.json").version') + echo "STEEDOS_VERSION=${STEEDOS_VERSION}" >> $GITHUB_ENV + echo "STEEDOS_VERSION=${STEEDOS_VERSION}" + + - name: Generate info.json + run: | + if [[ -f deploy/community/scripts/generate_info_json.sh ]]; then + deploy/community/scripts/generate_info_json.sh + fi + + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + with: + driver-opts: network=host + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + steedos/steedos-community + 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn/dockerhub/steedos/steedos-community + tags: | + type=semver,pattern={{version}},value=${{ env.STEEDOS_VERSION }} + type=semver,pattern={{major}}.{{minor}},value=${{ env.STEEDOS_VERSION }} + type=semver,pattern={{major}},value=${{ env.STEEDOS_VERSION }} + + - uses: docker/login-action@v1 + name: Login Docker Hub + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_NINGXIA }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_NINGXIA }} + aws-region: cn-northwest-1 + - + name: Login to ECR + uses: docker/login-action@v2 + with: + registry: 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn + + - name: Replace Version ~2.7 to Tag + uses: jacobtomlinson/gha-find-replace@v2 + with: + include: deploy/community/app/platform/package.json + find: "~2.7" + replace: ${{env.STEEDOS_VERSION}} + regex: false + + - name: Build and push docker + uses: docker/build-push-action@v3 + with: + context: ./deploy/community + platforms: linux/amd64 #,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + docker-enterprise: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + steps: + - uses: nowsprinting/check-version-format-action@v3 + id: version + with: + prefix: 'v' + + - name: Check valid tag format + if: steps.version.outputs.is_valid == 'false' + run: exit 1 + + - name: Get branch names + id: branch-name + uses: tj-actions/branch-names@v5.2 + with: + strip_tag_prefix: v + + - name: Get the current tag + if: steps.branch-name.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/') + run: | + echo "tag: ${{ steps.branch-name.outputs.tag }}" + echo "current_branch: ${{ steps.branch-name.outputs.current_branch }}" + echo "ref_branch: ${{ steps.branch-name.outputs.ref_branch }}" + + - name: Check valid branch + if: ${{ !startsWith(steps.branch-name.outputs.tag, '2.') }} + run: exit 1 + + # checkout branch 2.7 + - name: Checkout branch 2.7 + uses: actions/checkout@v2 + if: ${{ startsWith(steps.branch-name.outputs.tag, '2.7') }} + with: + ref: '2.7' + + # checkout branch 2.6 + - name: Checkout branch 2.6 + uses: actions/checkout@v2 + if: ${{ startsWith(steps.branch-name.outputs.tag, '2.6') }} + with: + ref: '2.6' + + - name: Set Current Version + run: | + STEEDOS_VERSION=$(node -p 'require("./lerna.json").version') + echo "STEEDOS_VERSION=${STEEDOS_VERSION}" >> $GITHUB_ENV + echo "STEEDOS_VERSION=${STEEDOS_VERSION}" + + - name: Generate info.json + run: | + if [[ -f deploy/enterprise/scripts/generate_info_json.sh ]]; then + deploy/enterprise/scripts/generate_info_json.sh + fi + + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + with: + driver-opts: network=host + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + steedos/steedos-enterprise + 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn/dockerhub/steedos/steedos-enterprise + tags: | + type=semver,pattern={{version}},value=${{ env.STEEDOS_VERSION }} + type=semver,pattern={{major}}.{{minor}},value=${{ env.STEEDOS_VERSION }} + type=semver,pattern={{major}},value=${{ env.STEEDOS_VERSION }} + + - uses: docker/login-action@v1 + name: Login Docker Hub + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_NINGXIA }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_NINGXIA }} + aws-region: cn-northwest-1 + - + name: Login to ECR + uses: docker/login-action@v2 + with: + registry: 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn + + - name: Replace Version ~2.7 to Tag + uses: jacobtomlinson/gha-find-replace@v2 + with: + include: deploy/enterprise/app/platform/package.json + find: "~2.7" + replace: ${{env.STEEDOS_VERSION}} + regex: false + + - name: Build and push docker + uses: docker/build-push-action@v3 + if: ${{ steps.version.outputs.is_stable != 'true' }} + with: + context: ./deploy/enterprise + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + # 正式版才发布 arm64 + - name: Build and push docker + uses: docker/build-push-action@v3 + if: ${{ steps.version.outputs.is_stable == 'true' }} + with: + context: ./deploy/enterprise + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}