fix docker
All checks were successful
release / Release (push) Successful in 2m34s

This commit is contained in:
2026-02-27 17:07:38 +09:00
parent 31114ecd74
commit cab700e6fb
2 changed files with 34 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
name: build and push image name: release
on: on:
schedule: schedule:
@@ -7,10 +7,10 @@ on:
env: env:
TAG: latest TAG: latest
IMAGE_ID: aios
IMAGE_NAME: ${{ gitea.repository }} IMAGE_NAME: ${{ gitea.repository }}
APP_TOKEN: ${{ secrets.APP_TOKEN }} APP_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: localhost:8088 REGISTRY: localhost:8088
GITEA_URL: https://git.syui.ai
jobs: jobs:
release: release:
@@ -20,10 +20,25 @@ jobs:
image: ghcr.io/syui/aios image: ghcr.io/syui/aios
options: --privileged options: --privileged
steps: steps:
- name: Pull and re-tag image - name: Pull and push to local registry
run: | run: |
pacman -Sy --noconfirm docker pacman -Sy --noconfirm docker
docker pull ghcr.io/syui/aios docker pull ghcr.io/syui/aios
docker tag ghcr.io/syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} docker tag ghcr.io/syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
- name: Create release with tarball
run: |
curl -s -o aios.tar.gz -L "https://github.com/syui/aios/releases/download/latest/aios.tar.gz"
existing=$(curl -s -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/tags/${{ env.TAG }}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if [ -n "$existing" ]; then
curl -s -X DELETE -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/$existing"
fi
git tag -f ${{ env.TAG }} 2>/dev/null || true
release_id=$(curl -s -X POST -H "Authorization: token ${{ env.APP_TOKEN }}" -H "Content-Type: application/json" \
-d '{"tag_name":"${{ env.TAG }}","name":"${{ env.TAG }}","body":"build '$(date +%Y.%m.%d)'"}' \
"${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
curl -s -X POST -H "Authorization: token ${{ env.APP_TOKEN }}" \
-F "attachment=@aios.tar.gz" \
"${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/$release_id/assets"

View File

@@ -7,53 +7,37 @@ on:
permissions: permissions:
contents: write contents: write
packages: write
env: env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} APP_TOKEN: ${{ secrets.APP_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: ghcr.io
jobs: jobs:
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install build dependencies
run: pacman -Sy --noconfirm arch-install-scripts zsh
- name: Build aios - name: Build aios
run: zsh ./build.zsh
- name: Create Docker images
run: | run: |
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }} docker run --rm --privileged \
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin -v ${{ github.workspace }}:/work -w /work \
docker push ${{ env.IMAGE_NAME }} archlinux:latest \
bash -c "pacman -Sy --noconfirm arch-install-scripts zsh && zsh ./build.zsh"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
- name: Push to GitHub Container Registry - name: Push to GitHub Container Registry
run: | run: |
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} cat aios.tar.gz | docker import - syui/aios
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} echo "${{ env.APP_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker tag syui/aios ghcr.io/syui/aios
docker push ghcr.io/syui/aios
- name: Create new release - name: Create new release
uses: softprops/action-gh-release@v1 env:
with: GH_TOKEN: ${{ env.APP_TOKEN }}
name: latest run: |
tag_name: latest gh release delete latest --yes --cleanup-tag || true
files: git tag -f latest
aios.tar.gz git push -f origin latest
gh release create latest aios.tar.gz --title "latest" --notes "build $(date +%Y.%m.%d)"