github.com/kubevela/workflow@v0.6.0/.github/workflows/chart.yaml (about) 1 name: HelmChart 2 on: 3 push: 4 tags: 5 - "v*" 6 workflow_dispatch: {} 7 8 env: 9 BUCKET: ${{ secrets.OSS_BUCKET }} 10 ENDPOINT: ${{ secrets.OSS_ENDPOINT }} 11 ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }} 12 ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }} 13 14 jobs: 15 publish-images: 16 runs-on: ubuntu-latest 17 steps: 18 - uses: actions/checkout@master 19 - name: Get the vars 20 id: vars 21 run: | 22 if [[ ${GITHUB_REF} == "refs/heads/main" ]]; then 23 echo ::set-output name=TAG::latest 24 else 25 echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} 26 fi 27 echo ::set-output name=GITVERSION::git-$(git rev-parse --short HEAD) 28 - name: Login Docker Hub 29 uses: docker/login-action@v1 30 with: 31 username: ${{ secrets.DOCKER_USER }} 32 password: ${{ secrets.DOCKER_PASSWORD }} 33 - uses: docker/setup-qemu-action@v1 34 - uses: docker/setup-buildx-action@v1 35 with: 36 driver-opts: image=moby/buildkit:master 37 38 - uses: docker/build-push-action@v2 39 name: Build & Pushing vela-workflow for Dockerhub 40 with: 41 context: . 42 file: ./Dockerfile 43 labels: |- 44 org.opencontainers.image.source=https://github.com/${{ github.repository }} 45 org.opencontainers.image.revision=${{ github.sha }} 46 platforms: linux/amd64,linux/arm64 47 push: ${{ github.event_name != 'pull_request' }} 48 build-args: | 49 GOPROXY=https://proxy.golang.org 50 VERSION=${{ steps.vars.outputs.TAG }} 51 GIT_VERSION=${{ steps.vars.outputs.GITVERSION }} 52 tags: |- 53 docker.io/oamdev/vela-workflow:${{ steps.vars.outputs.TAG }} 54 55 publish-charts: 56 env: 57 HELM_CHART: charts/vela-workflow 58 LOCAL_OSS_DIRECTORY: .oss/ 59 runs-on: ubuntu-20.04 60 steps: 61 - uses: actions/checkout@master 62 - name: Get the vars 63 id: vars 64 run: | 65 echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} 66 - name: Install Helm 67 uses: azure/setup-helm@v1 68 with: 69 version: v3.4.0 70 - name: Setup node 71 uses: actions/setup-node@v2 72 with: 73 node-version: '14' 74 - uses: oprypin/find-latest-tag@v1 75 with: 76 repository: kubevela/workflow 77 releases-only: true 78 id: latest_tag 79 - name: Tag helm chart image 80 run: | 81 latest_repo_tag=${{ steps.latest_tag.outputs.tag }} 82 sub="." 83 major="$(cut -d"$sub" -f1 <<<"$latest_repo_tag")" 84 minor="$(cut -d"$sub" -f2 <<<"$latest_repo_tag")" 85 patch="0" 86 current_repo_tag="$major.$minor.$patch" 87 image_tag=${GITHUB_REF#refs/tags/} 88 chart_version=$latest_repo_tag 89 if [[ ${GITHUB_REF} == "refs/heads/main" ]]; then 90 image_tag=latest 91 chart_version=${current_repo_tag}-nightly-build 92 fi 93 sed -i "s/latest/${image_tag}/g" $HELM_CHART/values.yaml 94 chart_smever=${chart_version#"v"} 95 sed -i "s/0.1.0/$chart_smever/g" $HELM_CHART/Chart.yaml 96 - name: Install ossutil 97 run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil 98 - name: Configure Alibaba Cloud OSSUTIL 99 run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig 100 - name: sync cloud to local 101 run: ./ossutil --config-file .ossutilconfig sync oss://$BUCKET/core $LOCAL_OSS_DIRECTORY 102 - name: Package helm charts 103 run: | 104 helm package $HELM_CHART --destination $LOCAL_OSS_DIRECTORY 105 helm repo index --url https://$BUCKET.$ENDPOINT/core $LOCAL_OSS_DIRECTORY 106 - name: sync local to cloud 107 run: ./ossutil --config-file .ossutilconfig sync $LOCAL_OSS_DIRECTORY oss://$BUCKET/core -f