From b5047904386a544b82a2e609c0adcea64397b76f Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 6 Jan 2025 16:53:04 +0800 Subject: [PATCH 1/6] =?UTF-8?q?[+]=20fix=20=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init-apt.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init-apt.sh b/init-apt.sh index aab715e..98198e6 100644 --- a/init-apt.sh +++ b/init-apt.sh @@ -38,4 +38,9 @@ server ntp5.aliyun.com iburst driftfile /var/lib/chrony/drift allow 127.0.0.1 EOF -systemctl restart chrony && systemctl enable chrony \ No newline at end of file +systemctl restart chrony && systemctl enable chrony + +# fix vim 粘贴 +if ! grep -q "set pastetoggle=" ~/.vimrc; then + echo "set pastetoggle=" >> ~/.vimrc +fi \ No newline at end of file From f4ec37b97c57d370581dbe4620f75f6ac87dca49 Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 13 Jan 2025 15:42:08 +0800 Subject: [PATCH 2/6] =?UTF-8?q?[+]=20=E5=A2=9E=E5=8A=A0=20git=20pip=20npm?= =?UTF-8?q?=20bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++++ init-all.sh | 8 +++++++- init-git.sh | 8 ++++++++ init-npm.sh | 8 ++++++++ init-pip.sh | 8 ++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 init-git.sh create mode 100644 init-npm.sh create mode 100644 init-pip.sh diff --git a/README.md b/README.md index 2f94306..80d5952 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,14 @@ curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash # docker-ce curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash +# npm +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-npm.sh | bash +# pip +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-pip.sh | bash +# git +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh | bash + + # 初始化全部 curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-all.sh | bash ``` diff --git a/init-all.sh b/init-all.sh index 57e6756..3a0ea27 100644 --- a/init-all.sh +++ b/init-all.sh @@ -3,4 +3,10 @@ # apt + ntp curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash # docker-ce -curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash \ No newline at end of file +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash +# npm +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-npm.sh | bash +# pip +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-pip.sh | bash +# git +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh | bash \ No newline at end of file diff --git a/init-git.sh b/init-git.sh new file mode 100644 index 0000000..cfe833e --- /dev/null +++ b/init-git.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# 检查 git 是否安装 +if command -v pip &> /dev/null; then + echo "git 已安装,正在配置镜像源..." + git config --global url."https://git-proxy.hk.martin98.com/".insteadOf "https://" + echo "镜像源配置完成。" +fi \ No newline at end of file diff --git a/init-npm.sh b/init-npm.sh new file mode 100644 index 0000000..f023d23 --- /dev/null +++ b/init-npm.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# 检查 npm 是否安装 +if command -v npm &> /dev/null; then + echo "npm 已安装,正在配置镜像源..." + npm config set registry https://mirrors.martin98.com/repository/npm-group/ + echo "镜像源配置完成。" +fi \ No newline at end of file diff --git a/init-pip.sh b/init-pip.sh new file mode 100644 index 0000000..19e96ee --- /dev/null +++ b/init-pip.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# 检查 pip 是否安装 +if command -v pip &> /dev/null; then + echo "pip 已安装,正在配置镜像源..." + pip config set global.index-url https://mirrors.martin98.com/repository/pypi-group/simple + echo "镜像源配置完成。" +fi \ No newline at end of file From ede14fd99b74a24cb18a94215c53479ffdbf2fbb Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 13 Jan 2025 15:51:37 +0800 Subject: [PATCH 3/6] =?UTF-8?q?[+]=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/demo.yaml | 29 +++++++++++++++++++++++++++++ Dockerfile | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 .gitea/workflows/demo.yaml create mode 100644 Dockerfile diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml new file mode 100644 index 0000000..14cc5f6 --- /dev/null +++ b/.gitea/workflows/demo.yaml @@ -0,0 +1,29 @@ +name: Build Docker Image +on: + push: + branches: + - main + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + registry: ${{ secrets.DOCKER_HUB }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.DOCKER_TAG }}:latest + ${{ secrets.DOCKER_TAG }}:${{ github.sha }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27a51f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch + +COPY *.sh /scripts \ No newline at end of file From 1fe510105a8b651b97334dde38c9aec1106e4eaf Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 13 Jan 2025 16:07:39 +0800 Subject: [PATCH 4/6] =?UTF-8?q?[+]=20=E6=B5=8B=E8=AF=95=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/{demo.yaml => docker.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .gitea/workflows/{demo.yaml => docker.yaml} (86%) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/docker.yaml similarity index 86% rename from .gitea/workflows/demo.yaml rename to .gitea/workflows/docker.yaml index 14cc5f6..c6fb2b7 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/docker.yaml @@ -14,8 +14,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v2 with: - registry: ${{ secrets.DOCKER_HUB }} - username: ${{ secrets.DOCKER_USERNAME }} + registry: ${{ vars.DOCKER_HUB }} + username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push From e01366ede1d7b6467b5d118ea4b1e2dcf948311e Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 13 Jan 2025 16:23:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?[*]=20=E6=9B=B4=E6=96=B0=E7=A7=81=E6=9C=89?= =?UTF-8?q?=E5=8C=96actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/docker.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/docker.yaml b/.gitea/workflows/docker.yaml index c6fb2b7..7952f1f 100644 --- a/.gitea/workflows/docker.yaml +++ b/.gitea/workflows/docker.yaml @@ -9,17 +9,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: https://git.martin98.com/actions/checkout.git@v4 - name: Log in to Docker Hub - uses: docker/login-action@v2 + uses: https://git.martin98.com/actions/login-action.git@v3 with: registry: ${{ vars.DOCKER_HUB }} username: ${{ vars.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + password: ${{ vars.DOCKER_PASSWORD }} - name: Build and push - uses: docker/build-push-action@v4 + uses: https://git.martin98.com/actions/build-push-action.git@v4 with: context: . platforms: linux/amd64 From ed14758b6b975fef8d7fd26381e75b7b19fe952e Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Mon, 13 Jan 2025 16:27:00 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/docker.yaml b/.gitea/workflows/docker.yaml index 7952f1f..09054c1 100644 --- a/.gitea/workflows/docker.yaml +++ b/.gitea/workflows/docker.yaml @@ -25,5 +25,5 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ secrets.DOCKER_TAG }}:latest - ${{ secrets.DOCKER_TAG }}:${{ github.sha }} \ No newline at end of file + docker.martin98.com/martin_farm/init:latest + docker.martin98.com/martin_farm/init:${{ github.sha }} \ No newline at end of file