From aa7de72033ee59a7f5afe20f7007d2a920e2858c Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 21 Feb 2024 22:45:41 +0900 Subject: [PATCH] add golang --- .gitea/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 10 +++++-- archiso | 1 - archlinux-docker | 1 - build.zsh | 6 ++-- cfg/gh-actions.yml | 4 +-- 6 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 .gitea/workflows/release.yml delete mode 160000 archiso delete mode 160000 archlinux-docker diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..a460e38 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,52 @@ +name: Build and Push Image +on: [ push ] + +env: + USERNAME: ai + IMAGE_NAME: ${{ gitea.repository }} + APP_TOKEN: ${{ secrets.APP_TOKEN }} + REGISTRY: localhost:8088 + +jobs: + release: + name: Release + runs-on: ubuntu-latest + container: + image: syui/aios + options: --privileged + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Initialize + run: | + pacman -Syuu --noconfirm base-devel archiso docker git nodejs + git clone https://gitlab.archlinux.org/archlinux/archiso + cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/ + cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh + cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh + cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso + ./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/ + tar xf aios-bootstrap*.tar.gz + mkdir -p root.x86_64/var/lib/machines/arch + pacstrap -c root.x86_64/var/lib/machines/arch base + echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch + Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist + sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf + arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' + arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' + arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs' + arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh' + arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai' + tar -zcvf aios-bootstrap.tar.gz root.x86_64/ + tar -C ./root.x86_64 -c . | docker import - ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }} + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: syui + password: ${{ env.APP_TOKEN }} + - name: github container registry + run: | + docker push ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7b4a71..8d1351b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v4 - name: Initialize run: | - pacman -Syuu --noconfirm base-devel archiso docker git + pacman -Syuu --noconfirm base-devel archiso docker git nodejs git clone https://gitlab.archlinux.org/archlinux/archiso cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/ cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh @@ -36,11 +36,14 @@ jobs: cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso ./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/ tar xf aios-bootstrap*.tar.gz - echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch\nServer = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist + mkdir -p root.x86_64/var/lib/machines/arch + pacstrap -c root.x86_64/var/lib/machines/arch base + echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch + Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' - arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq' + arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs' arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh' arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai' tar -zcvf aios-bootstrap.tar.gz root.x86_64/ @@ -66,3 +69,4 @@ jobs: tag_name: latest files: aios-bootstrap.tar.gz + diff --git a/archiso b/archiso deleted file mode 160000 index 1f65b69..0000000 --- a/archiso +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1f65b695d309d6089bdc2251bb4c9aa00bd11a51 diff --git a/archlinux-docker b/archlinux-docker deleted file mode 160000 index 98cd791..0000000 --- a/archlinux-docker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 98cd79111dd530447f491d547d14f3c38e227e46 diff --git a/build.zsh b/build.zsh index 4b809b0..0853e2c 100755 --- a/build.zsh +++ b/build.zsh @@ -1,5 +1,5 @@ #!/bin/zsh -pacman -Syuu --noconfirm base-devel archiso docker git +pacman -Syuu --noconfirm base-devel archiso docker git nodejs git clone https://gitlab.archlinux.org/archlinux/archiso cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/ cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh @@ -7,12 +7,14 @@ cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso ./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/ tar xf aios-bootstrap*.tar.gz +mkdir -p root.x86_64/var/lib/machines/arch +pacstrap -c root.x86_64/var/lib/machines/arch base echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' -arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq' +arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs' arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh' arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai' tar -zcvf aios-bootstrap.tar.gz root.x86_64/ diff --git a/cfg/gh-actions.yml b/cfg/gh-actions.yml index f45bedc..8d1351b 100644 --- a/cfg/gh-actions.yml +++ b/cfg/gh-actions.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v4 - name: Initialize run: | - pacman -Syuu --noconfirm base-devel archiso docker git + pacman -Syuu --noconfirm base-devel archiso docker git nodejs git clone https://gitlab.archlinux.org/archlinux/archiso cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/ cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh @@ -43,7 +43,7 @@ jobs: sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' - arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq' + arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs' arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh' arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai' tar -zcvf aios-bootstrap.tar.gz root.x86_64/