|
5 | 5 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
6 | 6 | name: Build Release
|
7 | 7 |
|
8 |
| -env: |
9 |
| - # TODO: Change variable to your image's name. |
10 |
| - IMAGE_NAME: ks-console |
11 |
| - IMAGE_REPO: kubesphere |
12 |
| - |
13 | 8 | jobs:
|
14 |
| - release-linux-amd64: |
| 9 | + release: |
15 | 10 | runs-on: ubuntu-latest
|
16 | 11 | if: github.repository == 'kubesphere/console'
|
17 | 12 | steps:
|
18 | 13 | - uses: actions/checkout@v2
|
19 | 14 |
|
| 15 | + - name: Login to Aliyun |
| 16 | + uses: docker/login-action@v3 |
| 17 | + with: |
| 18 | + registry: registry.cn-beijing.aliyuncs.com |
| 19 | + username: ${{ secrets.ALIYUNCS_USERNAME }} |
| 20 | + password: ${{ secrets.ALIYUNCS_PASSWORD }} |
| 21 | + |
| 22 | + - name: Login to DOCKER |
| 23 | + uses: docker/login-action@v3 |
| 24 | + with: |
| 25 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 26 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 27 | + |
20 | 28 | - name: Set up QEMU
|
21 |
| - uses: docker/setup-qemu-action@v1 |
| 29 | + uses: docker/setup-qemu-action@v3 |
22 | 30 | with:
|
23 | 31 | platforms: all
|
24 | 32 |
|
25 | 33 | - name: Set up Docker buildx
|
26 |
| - uses: docker/setup-buildx-action@v1 |
| 34 | + uses: docker/setup-buildx-action@v3 |
27 | 35 |
|
28 |
| - - name: Log into registry |
29 |
| - run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin |
| 36 | + - name: Chose Registry by tag |
| 37 | + id: chose_registry |
| 38 | + run: | |
| 39 | + if [[ ${GITHUB_REF#refs/*/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 40 | + echo "env=prod" >> "$GITHUB_OUTPUT" |
| 41 | + else |
| 42 | + echo "env=dev" >> "$GITHUB_OUTPUT" |
| 43 | + fi |
| 44 | + echo "tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT" |
30 | 45 |
|
31 |
| - - name: Push image |
| 46 | + - name: Generate output dir |
32 | 47 | run: |
|
33 |
| - TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push |
34 |
| - echo "Push $IMAGE success!" |
| 48 | + make container-cross |
| 49 | +
|
| 50 | + - name: Build and push ks-console images |
| 51 | + uses: docker/build-push-action@v6 |
| 52 | + if: steps.chose_registry.outputs.env == 'prod' |
| 53 | + with: |
| 54 | + context: ${{ github.workspace }} |
| 55 | + file: build/Dockerfile.dapper |
| 56 | + platforms: linux/amd64,linux/arm64 |
| 57 | + push: true |
| 58 | + tags: | |
| 59 | + docker.io/kubesphere/ks-console:${{ steps.chose_registry.outputs.tag }} |
| 60 | + registry.cn-beijing.aliyuncs.com/kubesphereio/ks-console:${{ steps.chose_registry.outputs.tag }} |
| 61 | +
|
| 62 | + - name: Build and push ks-console dev images |
| 63 | + uses: docker/build-push-action@v6 |
| 64 | + if: steps.chose_registry.outputs.env == 'dev' |
| 65 | + with: |
| 66 | + context: ${{ github.workspace }} |
| 67 | + file: build/Dockerfile.dapper |
| 68 | + platforms: linux/amd64,linux/arm64 |
| 69 | + push: true |
| 70 | + tags: | |
| 71 | + docker.io/kubespheredev/ks-console:${{ steps.chose_registry.outputs.tag }} |
0 commit comments