diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e38bf63 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: release + +on: + schedule: + - cron: '0 0 * * *' + push: + - main + +jobs: + build: + runs-on: ubuntu-latest + container: + image: archlinux:base + options: --privileged + steps: + - name: restore pacman cache + uses: actions/cache@v4 + with: + path: /var/cache/pacman/pkg + key: pacman-cache-${{ github.workflow }}-build + + - name: install + run: pacman -Syyu --noconfirm archiso docker + + - name: checkout + uses: actions/checkout@v4 + + - name: build + env: + DOCKER_USER: ${{ secrets.DOCKER_USER }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: | + ./build.zsh + systemctl start docker + docker login -u=$DOCKER_USER -p=$DOCKER_PASSWORD + tar -C ./root.x86_64 -c . | docker import - syui/aios + docker push syui/aios + + - name: bootstrap + uses: actions/upload-artifact@v4 + with: + name: aios-bootstrap + path: ./*.tar.gz diff --git a/README.md b/README.md index e008029..4a48c40 100644 --- a/README.md +++ b/README.md @@ -57,4 +57,3 @@ $ docker run --rm syui/aios cargo version cargo 1.75.0 ``` - diff --git a/build.zsh b/build.zsh index b6e676d..e8fa1bd 100755 --- a/build.zsh +++ b/build.zsh @@ -4,9 +4,15 @@ d=${0:a:h} case $1 in bsae) a=baseline + docker=true + ;; + gh) + a=releng + docker=false ;; *) a=releng + docker=true ;; esac @@ -49,11 +55,11 @@ arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linu 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' # docker image -systemctl start docker -tar -C $d/root.x86_64 -c . | docker import - syui/aios +if [ $docker = true ];then + systemctl start docker + tar -C $d/root.x86_64 -c . | docker import - syui/aios -docker images -a -docker run --rm syui/aios ai -docker push syui/aios - -# docker run -it syui/aios zsh + docker images -a + docker run --rm syui/aios ai + docker push syui/aios +fi