fix: build error #78
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@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: get image name | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
DOCKER_IMAGE_NAME=$(echo "docker.io/mereith/van-nav:v${VERSION}") | |
DOCKER_IMAGE_NAME_LATEST=$(echo "docker.io/mereith/van-nav:latest") | |
echo ${VERSION} | |
echo "::set-output name=DOCKER_IMAGE_NAME::$DOCKER_IMAGE_NAME" | |
echo "::set-output name=DOCKER_IMAGE_NAME_LATEST::$DOCKER_IMAGE_NAME_LATEST" | |
id: image-name | |
- name: Build image And Push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
cache-from: type=registry,ref=mereith/van-nav:buildcache | |
cache-to: type=registry,ref=mereith/van-nav:buildcache,mode=max | |
tags: | | |
${{ steps.image-name.outputs.DOCKER_IMAGE_NAME }} | |
${{ steps.image-name.outputs.DOCKER_IMAGE_NAME_LATEST }} | |
- name: deploy to cluster | |
uses: steebchen/kubectl@v2.0.0 | |
with: # defaults to latest kubectl binary version | |
config: ${{ secrets.K8S_CONFIG_DATA }} | |
command: set image deployment/tools-prod -n tools tools=${{ steps.image-name.outputs.DOCKER_IMAGE_NAME }} | |
- name: deploy to cluster for demo | |
uses: steebchen/kubectl@v2.0.0 | |
with: # defaults to latest kubectl binary version | |
config: ${{ secrets.K8S_CONFIG_DATA }} | |
command: set image deployment/tools-demo -n tools tools=${{ 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 }} |