mirror of
https://github.com/Damillora/phoebe.git
synced 2025-03-10 14:07:22 +00:00
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
env:
|
|
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform: [linux/amd64,linux/arm64]
|
|
env:
|
|
IS_LINUX: ${{ startsWith(matrix.platform, 'linux/') && 'true' || 'false' }}
|
|
GIT_TAG: ${{ needs.git-version.outputs.git_tag }}
|
|
steps:
|
|
-
|
|
name: Sanitize platform name
|
|
id: set_platform
|
|
run: |
|
|
PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '_')
|
|
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
-
|
|
name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
-
|
|
name: Build Binaries
|
|
id: docker_build_bin
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: ${{ matrix.platform }}
|
|
target: runtime
|
|
outputs: |
|
|
type=local,dest=./output/${{ env.PLATFORM }}
|
|
-
|
|
name: Upload Binaries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: shioriko-${{ env.PLATFORM }}
|
|
path: ./output
|
|
retention-days: 7
|
|
-
|
|
name: Build and push (No tag)
|
|
if: env.IS_LINUX == 'true' && env.IS_RELEASE == 'false'
|
|
id: docker_build_git
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
platforms: ${{ matrix.platform }}
|
|
tags: damillora/shioriko:main
|
|
-
|
|
name: Build and push (Tagged)
|
|
if: env.IS_LINUX == 'true' && env.IS_RELEASE == 'true'
|
|
id: docker_build_release
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
platforms: ${{ matrix.platform }}
|
|
tags: damillora/shioriko:${{ env.GIT_TAG }}, damillora/shioriko:latest
|
|
-
|
|
name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|