phoebe/.github/workflows/workflow.yml

75 lines
2.1 KiB
YAML
Raw Normal View History

2021-05-10 22:47:35 +07:00
name: CI
2021-05-11 00:39:52 +07:00
on:
push:
branches:
- main
tags:
- "v*"
env:
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}
2021-05-10 22:47:35 +07:00
jobs:
build:
2021-05-10 22:47:35 +07:00
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 }}
2021-05-10 22:47:35 +07:00
steps:
-
name: Sanitize platform name
2025-02-23 19:18:55 +00:00
id: set_platform
run: |
PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '_')
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
2021-05-10 22:47:35 +07:00
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build Binaries
2025-02-23 19:18:55 +00:00
id: docker_build_bin
uses: docker/build-push-action@v6
2021-05-10 22:47:35 +07:00
with:
platforms: ${{ matrix.platform }}
2025-02-23 19:22:51 +00:00
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'
2025-02-23 19:18:55 +00:00
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'
2025-02-23 19:18:55 +00:00
id: docker_build_release
uses: docker/build-push-action@v6
with:
push: true
platforms: ${{ matrix.platform }}
2025-02-23 19:18:55 +00:00
tags: damillora/shioriko:${{ env.GIT_TAG }}, damillora/shioriko:latest
2021-05-10 22:47:35 +07:00
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}