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@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 id: docker_build uses: docker/build-push-action@v6 with: push: true platforms: ${{ matrix.platform }} 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 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 uses: docker/build-push-action@v6 with: push: true platforms: ${{ matrix.platform }} tags: damillora/shioriko:${{ env.GIT_TAG }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }}