name: build on: push: branches: - local-test jobs: build-rust: runs-on: joylink-local233 steps: - name: 检出代码 uses: https://gitea.joylink.club/actions/checkout@v4 with: submodules: recursive - name: Install Rust run: | export RUSTUP_DIST_SERVER="https://rsproxy.cn" export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh -s -- -y echo "\n execute source $HOME/.cargo/env and validate rustup version" . "$HOME/.cargo/env" echo $PATH rustup --version mkdir -p ~/.cargo echo '[source.crates-io]' > ~/.cargo/config.toml echo 'replace-with = "rsproxy-sparse"' >> ~/.cargo/config.toml echo '[source.rsproxy]' >> ~/.cargo/config.toml echo 'registry = "https://rsproxy.cn/crates.io-index"' >> ~/.cargo/config.toml echo '[source.rsproxy-sparse]' >> ~/.cargo/config.toml echo 'registry = "sparse+https://rsproxy.cn/index/"' >> ~/.cargo/config.toml echo '[registries.rsproxy]' >> ~/.cargo/config.toml echo 'index = "https://rsproxy.cn/crates.io-index"' >> ~/.cargo/config.toml echo '[net]' >> ~/.cargo/config.toml echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml cat ~/.cargo/config.toml - uses: https://gitea.joylink.club/actions/rust-cache@v2 - name: build Release run: | echo $PATH rustup target add x86_64-unknown-linux-musl cargo build --release --target x86_64-unknown-linux-musl - name: 设置 Docker uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1 - name: 设置 Docker Buildx uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3 - name: docker登录gitea.joylink.club uses: https://gitea.joylink.club/docker/login-action@v3 with: registry: gitea.joylink.club username: shengxuqiang password: ${{ secrets.SHENGXUQIANG_PASSWORD }} - name: Docker Build and push uses: https://gitea.joylink.club/docker/build-push-action@v5 with: context: . file: ./Dockerfile push: true tags: | gitea.joylink.club/joylink/rtss-simulation:local-test - name: 发布到本地测试环境 uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.LOCAL_233_SSH_HOST }} port: ${{ secrets.LOCAL_233_SSH_PORT }} username: ${{ secrets.LOCAL_233_SSH_USER }} password: ${{ secrets.LOCAL_233_SSH_PASSWORD }} script: | docker rm -f rtss-simulation || echo "rtss-simulation not exist" docker pull gitea.joylink.club/joylink/rtss-simulation:local-test docker run --name rtss-simulation --restart=always -e RUN_MODE=local-test --network net --ip 10.11.11.11 -d -p 8765:8765 -v /usr/local/joylink/logs/simulation:/logs/simulation gitea.joylink.club/joylink/rtss-simulation:local-test