ci: use gitea secrets for ssh keys
This commit is contained in:
		
							parent
							
								
									defd6072e1
								
							
						
					
					
						commit
						1efad5114a
					
				|  | @ -6,8 +6,6 @@ jobs: | ||||||
|   build: |   build: | ||||||
|     container: |     container: | ||||||
|       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest |       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest | ||||||
|       volumes: |  | ||||||
|         - /home/actions/.ssh:/root/.ssh |  | ||||||
|     steps: |     steps: | ||||||
|       - name: Check out repository code |       - name: Check out repository code | ||||||
|         uses: https://gitea.com/BoYanZh/checkout@focs |         uses: https://gitea.com/BoYanZh/checkout@focs | ||||||
|  | @ -17,7 +15,13 @@ jobs: | ||||||
|         run: | |         run: | | ||||||
|           go env -w GO111MODULE=on |           go env -w GO111MODULE=on | ||||||
|           go env -w GOPROXY=https://goproxy.io,direct |           go env -w GOPROXY=https://goproxy.io,direct | ||||||
|           chown -R root:root /root/.ssh |           mkdir -p ~/.ssh | ||||||
|  |           echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||||||
|  |           echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519.pub | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519 | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519.pub | ||||||
|  |           ssh-keyscan -p 2222 focs.ji.sjtu.edu.cn >> ~/.ssh/known_hosts | ||||||
|  |           ssh -T git@focs.ji.sjtu.edu.cn -p 2222 | ||||||
|       # - name: Setup Joint-Teapot |       # - name: Setup Joint-Teapot | ||||||
|       #   run: | |       #   run: | | ||||||
|       #       pip install git+https://ghp.ci/https://github.com/BoYanZh/Joint-Teapot |       #       pip install git+https://ghp.ci/https://github.com/BoYanZh/Joint-Teapot | ||||||
|  | @ -34,16 +38,22 @@ jobs: | ||||||
|   trigger-build-image: |   trigger-build-image: | ||||||
|     container: |     container: | ||||||
|       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest |       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest | ||||||
|       volumes: |  | ||||||
|         - /home/actions/.ssh:/root/.ssh |  | ||||||
|     needs: build |     needs: build | ||||||
|     if: github.ref == 'refs/heads/master' |     if: github.ref == 'refs/heads/master' | ||||||
|     steps: |     steps: | ||||||
|  |       - name: Set up SSH | ||||||
|  |         run: | | ||||||
|  |           mkdir -p ~/.ssh | ||||||
|  |           echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||||||
|  |           echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519.pub | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519 | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519.pub | ||||||
|  |           ssh-keyscan -p 2222 focs.ji.sjtu.edu.cn >> ~/.ssh/known_hosts | ||||||
|  |           ssh -T git@focs.ji.sjtu.edu.cn -p 2222 | ||||||
|       - name: Set up Git |       - name: Set up Git | ||||||
|         run: | |         run: | | ||||||
|           git config --global user.name "gitea-actions[bot]" |           git config --global user.name "gitea-actions[bot]" | ||||||
|           git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" |           git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" | ||||||
|           chown -R root:root /root/.ssh |  | ||||||
|       - name: Clone, Commit and Push |       - name: Clone, Commit and Push | ||||||
|         shell: bash |         shell: bash | ||||||
|         run: | |         run: | | ||||||
|  |  | ||||||
|  | @ -7,18 +7,24 @@ jobs: | ||||||
|   sync: |   sync: | ||||||
|     container: |     container: | ||||||
|       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest |       image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest | ||||||
|       volumes: |  | ||||||
|         - /home/actions/.ssh:/root/.ssh |  | ||||||
|     steps: |     steps: | ||||||
|       - name: Check out repository code |       - name: Check out repository code | ||||||
|         uses: https://gitea.com/BoYanZh/checkout@focs |         uses: https://gitea.com/BoYanZh/checkout@focs | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 0 |           fetch-depth: 0 | ||||||
|  |       - name: Set up SSH | ||||||
|  |         run: | | ||||||
|  |           mkdir -p ~/.ssh | ||||||
|  |           echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||||||
|  |           echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519.pub | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519 | ||||||
|  |           chmod 600 ~/.ssh/id_ed25519.pub | ||||||
|  |           ssh-keyscan -p 2222 focs.ji.sjtu.edu.cn >> ~/.ssh/known_hosts | ||||||
|  |           ssh -T git@focs.ji.sjtu.edu.cn -p 2222 | ||||||
|       - name: Set up Git |       - name: Set up Git | ||||||
|         run: | |         run: | | ||||||
|           git config --global user.name "gitea-actions[bot]" |           git config --global user.name "gitea-actions[bot]" | ||||||
|           git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" |           git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" | ||||||
|           chown -R root:root /root/.ssh |  | ||||||
|           git remote set-url origin ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3.git |           git remote set-url origin ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3.git | ||||||
|       - name: Check Git status |       - name: Check Git status | ||||||
|         run: | |         run: | | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user