name: 自动版本发布 on: push: branches: - main jobs: create-readme: runs-on: ubuntu-latest if: "contains(github.event.head_commit.message, 'Release')" steps: - name: 检查本地是否已经有ubuntu-latest镜像 id: check_ubuntu_image run: | if docker image inspect ubuntu:latest >/dev/null 2>&1; then echo "Ubuntu latest image is already present locally. Skipping pull." echo "::set-output name=should_pull::false" else echo "Ubuntu latest image is not present locally. Will pull." echo "::set-output name=should_pull::true" fi - name: 本地没有构建机器,下载ubuntu-latest if: steps.check_ubuntu_image.outputs.should_pull == 'true' run: docker pull ubuntu:latest - name: 替换软件源为国内软件源 run: | cat /etc/os-release sudo rm -f /etc/apt/sources.list sudo rm -f /etc/apt/sources.list.d/* sudo tee /etc/apt/sources.list <