3838 - run : make lint
3939
4040 coverage :
41- if : github.ref == 'refs/heads/main'
41+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta-v2'
4242 runs-on : ubuntu-latest
4343 permissions :
4444 contents : write
@@ -61,10 +61,56 @@ jobs:
6161 publish_dir : ./public
6262 force_orphan : true
6363
64- release :
64+ docker_deploy :
6565 if : github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
66+ name : " publish image on dockerhub"
67+ needs : [test, lint]
6668 runs-on : ubuntu-latest
69+ steps :
70+ - uses : actions/checkout@v3
71+ with :
72+ fetch-depth : 0
73+ - uses : docker/setup-qemu-action@v2
74+ - uses : docker/setup-buildx-action@v2
75+ - uses : actions/cache@v3
76+ with :
77+ path : /tmp/.buildx-cache
78+ key : ${{ runner.os }}-buildx-${{ github.sha }}
79+ restore-keys : |
80+ ${{ runner.os }}-buildx-
81+ - name : List docker image tags
82+ uses : docker/metadata-action@v4
83+ id : dockermeta
84+ with :
85+ images : tsuru/client
86+ tags : |
87+ type=match,value=latest,pattern=\d.\d.\d
88+ type=edge
89+ type=ref,event=branch
90+ type=semver,pattern={{version}}
91+ type=semver,pattern={{major}}.{{minor}}
92+ type=semver,pattern={{major}}
93+ - uses : docker/login-action@v2
94+ with :
95+ username : ${{ secrets.DOCKERHUB_USERNAME }}
96+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
97+ - name : Build and Push image to docker hub
98+ uses : docker/build-push-action@v3
99+ with :
100+ file : ./Dockerfile
101+ build-args : |
102+ DOCKER_BUILD_TSURU_VERSION="v${{steps.dockermeta.outputs.version}}"
103+ push : true
104+ tags : ${{ steps.dockermeta.outputs.tags }}
105+ labels : ${{ steps.dockermeta.outputs.labels }}
106+ cache-from : type=local,src=/tmp/.buildx-cache
107+ cache-to : type=local,dest=/tmp/.buildx-cache
108+ platforms : linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
109+
110+ release :
111+ if : github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
67112 needs : [test, lint]
113+ runs-on : ubuntu-latest
68114 permissions :
69115 contents : write
70116 steps :
@@ -81,4 +127,17 @@ jobs:
81127 version : " ~> v1.18" # v1.18.2
82128 args : release --clean
83129 env :
130+ # The automatic GitHub token (namely secrets.GITHUB_TOKEN) doesn't have permission cross-project.
131+ HOMEBREW_TSURU_REPOSITORY_AUTH_TOKEN : ${{ secrets.CUSTOM_GITHUB_TOKEN }}
84132 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
133+ AUR_KEY : ${{ secrets.PRIVATE_SSH_KEY }}
134+
135+ - uses : ruby/setup-ruby@v1
136+ with :
137+ ruby-version : ' 3.0'
138+ - name : Publish to Packagecloud
139+ run : ./scripts/build_publish_to_packagecloud.sh
140+ env :
141+ PACKAGE_NAME : tsuru-client
142+ PACKAGECLOUD_TOKEN : ${{ secrets.PACKAGECLOUD_TOKEN }}
143+ SKIP_GORELEASER : " true"
0 commit comments