# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. # # github:依次添加以下变量, # 路径:Settings -> Secrets And Variables -> Actions # Repository secrets -> New repository secret -> 输入变量名和值 # SERVER_HOST / Secret:服务器公网IP # SERVER_USERNAME / Secret:服务器用户名 # SERVER_PASSWORD / Secret:服务器密码 # SERVER_PORT / Secret:服务器端口 name: cicd on: push: tags: - 'v*' # 在推送的标签以"v"开头时执行 jobs: build: runs-on: ubuntu-latest # 运行环境 steps: - name: Checkout code uses: actions/checkout@v4 # https://github.com/actions/setup-java - name: install JDK17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: maven # https://github.com/arduino/setup-protoc - name: Install Protoc uses: arduino/setup-protoc@v3 - name: Maven build run: | mvn clean mvn -B -DskipTests=true install --file pom.xml cd starter mvn -B -DskipTests=true package --file pom.xml - name: Login to Docker Hub uses: docker/login-action@v3 with: username: bytedesk password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Login to Aliyun Docker uses: docker/login-action@v3 with: registry: registry.cn-hangzhou.aliyuncs.com username: ${{ secrets.ALIYUN_DOCKER_USERNAME }} password: ${{ secrets.ALIYUN_DOCKER_PASSWORD }} # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 # https://hub.docker.com/r/bytedesk/bytedesk-ce # https://cr.console.aliyun.com/repository/cn-hangzhou/bytedesk/bytedesk-ce/images - name: Build and push Docker images uses: docker/build-push-action@v6 with: context: ./starter file: ./starter/Dockerfile push: true tags: | bytedesk/bytedesk-ce:latest registry.cn-hangzhou.aliyuncs.com/bytedesk/bytedesk-ce:latest platforms: linux/amd64,linux/arm64,windows/amd64