add actions
This commit is contained in:
parent
b90fcbdd0d
commit
c87207e746
68
.github/workflows/release.yml
vendored
Normal file
68
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize
|
||||
run: |
|
||||
pacman -Syuu --noconfirm base-devel archiso docker git
|
||||
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
|
||||
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
|
||||
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 '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.IMAGE_NAME }}
|
||||
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
|
||||
docker push ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ env.GITHUB_TOKEN }}
|
||||
- name: github container registry
|
||||
run: |
|
||||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Create new release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: latest
|
||||
tag_name: latest
|
||||
files:
|
||||
aios-bootstrap.tar.gz
|
52
README.md
52
README.md
@ -3,58 +3,32 @@
|
||||
<img src="./icon/ai.png" width="100">
|
||||
|
||||
- name : ai os
|
||||
- image : [aios-bootstrap.tar.gz](https://github.com/syui/aios/releases/tag/latest)
|
||||
- base : [archlinux](https://gitlab.archlinux.org/archlinux)
|
||||
|
||||
### docker
|
||||
|
||||
```sh
|
||||
$ docker run --rm syui/aios ai
|
||||
$ docker run -it syui/aios ai
|
||||
```
|
||||
|
||||
### archiso
|
||||
|
||||
- [profile.rst](https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst)
|
||||
> Dockerfile
|
||||
|
||||
```sh
|
||||
$ pacman -S archiso
|
||||
FROM syui/aios
|
||||
```
|
||||
|
||||
- https://hub.docker.com/r/syui/aios
|
||||
|
||||
### github
|
||||
|
||||
```sh
|
||||
$ git clone https://git.syui.ai/ai/os
|
||||
$ cd os
|
||||
$ git clone https://gitlab.archlinux.org/archlinux/archlinux-docker
|
||||
$ git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||
|
||||
$ vim ./archiso/configs/releng/profiledef.sh
|
||||
|
||||
$ mkarchiso -v -o ./ ./archiso/configs/releng
|
||||
$ docker run -it ghcr.io/syui/aios ai
|
||||
```
|
||||
|
||||
### system
|
||||
|
||||
> ./archiso/configs/releng/profiledef.sh
|
||||
|
||||
```sh
|
||||
buildmodes=('bootstrap')
|
||||
```
|
||||
|
||||
```sh
|
||||
$ 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
|
||||
$ sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
|
||||
$ arch-chroot ./root.x86_64
|
||||
---
|
||||
$ pacman -S base base-devel linux vim git zsh rust
|
||||
$ pacman-key --init
|
||||
$ pacman-key --populate archlinux
|
||||
$ exit
|
||||
---
|
||||
$ tar -C root.x86_64 -c . | docker import - syui/aios
|
||||
$ docker images
|
||||
|
||||
$ docker run --rm syui/aios cargo version
|
||||
cargo 1.75.0
|
||||
```
|
||||
- https://github.com/users/syui/packages/container/package/aios
|
||||
|
||||
### link
|
||||
|
||||
- https://git.syui.ai/ai/os
|
||||
- https://github.com/syui/aios
|
||||
|
63
build.zsh
63
build.zsh
@ -1,59 +1,18 @@
|
||||
#!/bin/zsh
|
||||
|
||||
d=${0:a:h}
|
||||
case $1 in
|
||||
bsae)
|
||||
a=baseline
|
||||
;;
|
||||
*)
|
||||
a=releng
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if ! ls $d/*.tar.gz;then
|
||||
rm -rf $d/*.tar.gz
|
||||
fi
|
||||
|
||||
if [ -d $d/work ];then
|
||||
rm -rf $d/work
|
||||
fi
|
||||
|
||||
if [ -d $d/root.x86_64 ];then
|
||||
rm -rf $d/root.x86_64
|
||||
fi
|
||||
|
||||
if [ -d $d/archiso ];then
|
||||
rm -rf $d/archiso
|
||||
fi
|
||||
|
||||
pacman -Syuu --noconfirm base-devel archiso docker git
|
||||
git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||
|
||||
# rm -rf $d/archlinux-docker
|
||||
# git clone https://gitlab.archlinux.org/archlinux/archlinux-docker
|
||||
|
||||
cp -rf $d/cfg/profiledef.sh $d/archiso/configs/$a/profiledef.sh
|
||||
cp -rf $d/scpt/mkarchiso $d/archiso/archiso/mkarchiso
|
||||
|
||||
$d/archiso/archiso/mkarchiso -v -o $d/ $d/archiso/configs/releng
|
||||
|
||||
if [ ! -d $d/root.x86_64 ];then
|
||||
tar xf $d/aios-bootstrap*.tar.gz
|
||||
fi
|
||||
|
||||
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
|
||||
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
|
||||
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 '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'
|
||||
|
||||
# docker image
|
||||
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
|
||||
tar -zcvf aios-bootstrap.tar.gz root.x86_64/
|
||||
|
70
cfg/gh-actions.yml
Normal file
70
cfg/gh-actions.yml
Normal file
@ -0,0 +1,70 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize
|
||||
run: |
|
||||
pacman -Syuu --noconfirm base-devel archiso docker git
|
||||
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
|
||||
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 '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.IMAGE_NAME }}
|
||||
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
|
||||
docker push ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ env.GITHUB_TOKEN }}
|
||||
- name: github container registry
|
||||
run: |
|
||||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Create new release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: latest
|
||||
tag_name: latest
|
||||
files:
|
||||
aios-bootstrap.tar.gz
|
||||
|
125
docs/wiki.md
Normal file
125
docs/wiki.md
Normal file
@ -0,0 +1,125 @@
|
||||
### archiso
|
||||
|
||||
- [profile.rst](https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst)
|
||||
|
||||
```sh
|
||||
$ pacman -S archiso
|
||||
```
|
||||
|
||||
```sh
|
||||
$ git clone https://git.syui.ai/ai/os
|
||||
$ cd os
|
||||
$ git clone https://gitlab.archlinux.org/archlinux/archlinux-docker
|
||||
$ git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||
|
||||
$ vim ./archiso/configs/releng/profiledef.sh
|
||||
|
||||
$ mkarchiso -v -o ./ ./archiso/configs/releng
|
||||
```
|
||||
|
||||
### system
|
||||
|
||||
> ./archiso/configs/releng/profiledef.sh
|
||||
|
||||
```sh
|
||||
buildmodes=('bootstrap')
|
||||
```
|
||||
|
||||
```sh
|
||||
$ 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
|
||||
$ sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
|
||||
$ arch-chroot ./root.x86_64
|
||||
---
|
||||
$ pacman -S base base-devel linux vim git zsh rust
|
||||
$ pacman-key --init
|
||||
$ pacman-key --populate archlinux
|
||||
$ exit
|
||||
---
|
||||
$ tar -C root.x86_64 -c . | docker import - syui/aios
|
||||
$ docker images
|
||||
|
||||
$ docker run --rm syui/aios cargo version
|
||||
cargo 1.75.0
|
||||
```
|
||||
|
||||
### gh-actions
|
||||
|
||||
[.github/workflows/push.yml](https://docs.github.com/en/enterprise-cloud@latest/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions)
|
||||
|
||||
```yml
|
||||
name: Demo Push
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- seed
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
IMAGE_NAME: ghtoken_product_demo
|
||||
|
||||
jobs:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build image
|
||||
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
|
||||
- name: Log in to registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
|
||||
- name: Push image
|
||||
run: |
|
||||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
|
||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||
[ "$VERSION" == "main" ] && VERSION=latest
|
||||
echo IMAGE_ID=$IMAGE_ID
|
||||
echo VERSION=$VERSION
|
||||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
||||
docker push $IMAGE_ID:$VERSION
|
||||
```
|
||||
|
||||
### github-token
|
||||
|
||||
```yml
|
||||
env:
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ env.GITHUB_TOKEN }}
|
||||
- name: github container registry
|
||||
run: |
|
||||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
```
|
||||
|
||||
```sh
|
||||
# make gh-actions
|
||||
$ vim ./build.zsh
|
||||
$ ./scpt/gh-actions.zsh
|
||||
```
|
71
scpt/gh-actions.zsh
Executable file
71
scpt/gh-actions.zsh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/zsh
|
||||
|
||||
d=${0:a:h}
|
||||
dd=${0:a:h:h}
|
||||
|
||||
yml_a='name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize
|
||||
run: |'
|
||||
|
||||
yml_c=' tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
|
||||
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
|
||||
docker push ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ env.GITHUB_TOKEN }}
|
||||
- name: github container registry
|
||||
run: |
|
||||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Create new release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: latest
|
||||
tag_name: latest
|
||||
files:
|
||||
aios-bootstrap.tar.gz
|
||||
'
|
||||
|
||||
yml_b=`cat $dd/build.zsh |sed '1d'`
|
||||
|
||||
echo $yml_a >! $dd/cfg/gh-actions.yml
|
||||
echo $yml_b|sed 's/^/ /g' >> $dd/cfg/gh-actions.yml
|
||||
echo $yml_c >> $dd/cfg/gh-actions.yml
|
||||
cat $dd/cfg/gh-actions.yml
|
||||
|
||||
echo '#!/bin/zsh' >! $dd/build.zsh
|
||||
echo $yml_b >> $dd/build.zsh
|
||||
cat $dd/build.zsh
|
||||
|
Loading…
Reference in New Issue
Block a user