Skip to content

Commit

Permalink
fix(action): change image-registry and tag retrieval method
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceliu committed Oct 30, 2023
1 parent eaeb426 commit e7ef7c4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 121 deletions.
75 changes: 23 additions & 52 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,36 @@ on:
push:
# Publish `master` as Docker `latest` image.
branches:
# - master
- master
# - dev
- release-*

# Publish `v1.2.3` tags as releases.
tags:
- v*

- release-*
# Run build for any PRs.
pull_request:

jobs:
build-and-push:
runs-on: self-hosted

strategy:
matrix:
node-version: [12.18.x]
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: ks-console
IMAGE_REPO: kubespheredev

jobs:
release-linux-amd64:
runs-on: ubuntu-latest
if: github.repository == 'kubesphere/console'
steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i -g yarn && yarn

- name: Build
run: yarn build

- name: Test
run: yarn test
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Docker login
if: github.event_name == 'push'
uses: docker/login-action@v1
with:
registry: registry.cn-beijing.aliyuncs.com
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1

- name: Push image
if: github.event_name == 'push'
run: |
TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') REPO=registry.cn-beijing.aliyuncs.com/kubesphereio make container-cross-push
- name: Log into registry
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: slack
uses: 8398a7/action-slack@v3
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
if: failure()
- name: Push image
run: |
TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push
echo "Push $IMAGE success!"
63 changes: 0 additions & 63 deletions .github/workflows/manually.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/nightly-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
- name: Docker login
uses: docker/login-action@v1
with:
registry: registry.cn-beijing.aliyuncs.com
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Push image
run: |
TAG=nightly-$(date '+%Y%m%d') REPO=registry.cn-beijing.aliyuncs.com/kubesphereio make container-cross-push
TAG=nightly-$(date '+%Y%m%d') REPO=docker.io/kubespheredev make container-cross-push
# - name: slack
# uses: 8398a7/action-slack@v3
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
if: github.repository == 'kubesphere/console'
steps:
- uses: actions/checkout@v2
- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -33,5 +30,5 @@ jobs:

- name: Push image
run: |
TAG=${{ steps.get_version.outputs.VERSION }} REPO=$IMAGE_REPO make container-cross-push
TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push
echo "Push $IMAGE success!"

0 comments on commit e7ef7c4

Please sign in to comment.