chore: v1.9.0 #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DockerBuild And Deploy | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Login to AliyunCS | |
uses: docker/login-action@v1 | |
with: | |
registry: registry.cn-beijing.aliyuncs.com | |
username: ${{ secrets.ALI_USER }} | |
password: ${{ secrets.ALI_PASSWORD }} | |
- | |
name: get image name | |
run: | | |
VERSION=$(cat ./version.txt) | |
DOCKER_IMAGE_NAME=$(echo "docker.io/mereith/van-nav:v${VERSION}") | |
ALI_IMAGE_NAME=$(echo "registry.cn-beijing.aliyuncs.com/mereith/van-nav:v${VERSION}") | |
DOCKER_IMAGE_NAME_LATEST=$(echo "docker.io/mereith/van-nav:latest") | |
ALI_IMAGE_NAME_LATEST=$(echo "registry.cn-beijing.aliyuncs.com/mereith/van-nav:latest") | |
echo ${VERSION} | |
echo "::set-output name=DOCKER_IMAGE_NAME::$DOCKER_IMAGE_NAME" | |
echo "::set-output name=ALI_IMAGE_NAME::$ALI_IMAGE_NAME" | |
echo "::set-output name=DOCKER_IMAGE_NAME_LATEST::$DOCKER_IMAGE_NAME_LATEST" | |
echo "::set-output name=ALI_IMAGE_NAME_LATEST::$ALI_IMAGE_NAME_LATEST" | |
id: image-name | |
- name: Build image And Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.image-name.outputs.DOCKER_IMAGE_NAME }} | |
${{ steps.image-name.outputs.ALI_IMAGE_NAME }} | |
${{ steps.image-name.outputs.DOCKER_IMAGE_NAME_LATEST }} | |
${{ steps.image-name.outputs.ALI_IMAGE_NAME_LATEST }} | |
- name: deploy to cluster | |
uses: steebchen/[email protected] | |
with: # defaults to latest kubectl binary version | |
config: ${{ secrets.K3S_CONFIG_DATA }} | |
command: set image deployment/tools van-nav=${{ steps.image-name.outputs.DOCKER_IMAGE_NAME }} | |
- name: deploy to cluster for demo | |
uses: steebchen/[email protected] | |
with: # defaults to latest kubectl binary version | |
config: ${{ secrets.K3S_CONFIG_DATA }} | |
command: set image deployment/demo-tools demo=${{ steps.image-name.outputs.DOCKER_IMAGE_NAME }} | |
- name: send Message To me | |
run: | | |
curl -X POST -H "Content-Type: application/json" -d '{"source":"github-ci:van-nav","message":"流水线运行完毕,k8s, k3s 已部署。\n版本: ${{ github.ref_name }}" }' ${{ secrets.WEBHOOK_URL }} |