From ed436d4e6d179fe560b6505f15da942eb44c7eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E5=85=83?= Date: Fri, 29 Jan 2021 17:08:39 +0800 Subject: [PATCH] merge chart and docker publish into registry --- .github/workflows/dashboard.yml | 2 + .github/workflows/docker.yml | 57 ------------------- .../workflows/{charts.yaml => registry.yml} | 52 ++++++++++++++++- .github/workflows/release.yml | 3 +- 4 files changed, 53 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/docker.yml rename .github/workflows/{charts.yaml => registry.yml} (51%) diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index b3788dc89..1a07a3a0a 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -5,6 +5,8 @@ on: branches: [ master ] pull_request: branches: [master] + workflow_dispatch: {} + defaults: run: working-directory: ./dashboard diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 3e6a2427b..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Publish to Registry -on: - push: - branches: - - master - tags: - - "v*" - workflow_dispatch: {} - -jobs: - update: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Get the version - id: get_version - run: | - VERSION=${GITHUB_REF#refs/tags/} - if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then - VERSION=latest - fi - echo ::set-output name=VERSION::${VERSION} - - name: Get git revision - id: vars - shell: bash - run: | - echo "::set-output name=git_revision::$(git rev-parse --short HEAD)" - - name: Login ghcr.io - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.CR_PAT }} - - name: Login docker.io - uses: docker/login-action@v1 - with: - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/build-push-action@v2 - name: Build & Pushing - with: - context: . - file: Dockerfile - labels: |- - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.revision=${{ github.sha }} - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - build-args: | - GITVERSION=git-${{ steps.vars.outputs.git_revision }} - VERSION=${{ steps.get_version.outputs.VERSION }} - tags: |- - ghcr.io/${{ github.repository }}/vela-core:${{ steps.get_version.outputs.VERSION }} - docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/charts.yaml b/.github/workflows/registry.yml similarity index 51% rename from .github/workflows/charts.yaml rename to .github/workflows/registry.yml index 303417dae..fa730475e 100644 --- a/.github/workflows/charts.yaml +++ b/.github/workflows/registry.yml @@ -1,4 +1,4 @@ -name: Charts +name: Publish to Registry on: push: branches: @@ -14,7 +14,55 @@ env: ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }} jobs: - release: + publish-images: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Get the version + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/} + if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then + VERSION=latest + fi + echo ::set-output name=VERSION::${VERSION} + - name: Get git revision + id: vars + shell: bash + run: | + echo "::set-output name=git_revision::$(git rev-parse --short HEAD)" + - name: Login ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + - name: Login docker.io + uses: docker/login-action@v1 + with: + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + - uses: docker/build-push-action@v2 + name: Build & Pushing + with: + context: . + file: Dockerfile + labels: |- + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.revision=${{ github.sha }} + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + build-args: | + GITVERSION=git-${{ steps.vars.outputs.git_revision }} + VERSION=${{ steps.get_version.outputs.VERSION }} + tags: |- + ghcr.io/${{ github.repository }}/vela-core:${{ steps.get_version.outputs.VERSION }} + docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }} + + publish-charts: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@master diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1efeccbdd..c04a1d8a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,7 @@ on: workflow_dispatch: {} jobs: - build: - name: Build + publish-cli: runs-on: ubuntu-latest env: VELA_VERSION: ${{ github.ref }}