chore(version): 6.0.1 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish latest | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
upload_license: | |
name: Upload License | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: LICENSE | |
path: LICENSE | |
build: | |
name: Build cog ${{ matrix.os }}-${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
windows: true | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabihf | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: "true" | |
key: "${{ matrix.os }}-${{ matrix.target }}" | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- if: ${{ matrix.windows }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target ${{ matrix.target }} --release --locked | |
- if: ${{ ! matrix.windows }} | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --target ${{ matrix.target }} --release --locked | |
- if: ${{ ! matrix.windows }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/cog | |
- if: ${{ matrix.windows }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/cog.exe | |
upload_to_release: | |
needs: [ build, upload_license] | |
name: Publish cog binaries | |
runs-on: ubuntu-latest | |
if: ${{ github.ref_type == 'tag' }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: ~/artifacts | |
- name: Copy artifacts to archive | |
run: | | |
mkdir x86_64-unknown-linux-musl | |
cp -r /home/runner/artifacts/x86_64-unknown-linux-musl/cog x86_64-unknown-linux-musl/cog | |
chmod +x -R x86_64-unknown-linux-musl/cog | |
cp -r /home/runner/artifacts/LICENSE/LICENSE x86_64-unknown-linux-musl/ | |
tar -czf cocogitto-x86_64-unknown-linux-musl.tar.gz x86_64-unknown-linux-musl/* | |
mkdir armv7-unknown-linux-musleabihf | |
cp -r /home/runner/artifacts/armv7-unknown-linux-musleabihf/cog armv7-unknown-linux-musleabihf/cog | |
chmod +x -R armv7-unknown-linux-musleabihf/cog | |
cp -r /home/runner/artifacts/LICENSE/LICENSE armv7-unknown-linux-musleabihf/ | |
tar -czf cocogitto-armv7-unknown-linux-musleabihf.tar.gz armv7-unknown-linux-musleabihf/* | |
mkdir aarch64-unknown-linux-gnu | |
cp -r /home/runner/artifacts/aarch64-unknown-linux-gnu/cog aarch64-unknown-linux-gnu/cog | |
chmod +x -R aarch64-unknown-linux-gnu/cog | |
cp -r /home/runner/artifacts/LICENSE/LICENSE aarch64-unknown-linux-gnu/ | |
tar -czf cocogitto-aarch64-unknown-linux-gnu.tar.gz aarch64-unknown-linux-gnu/* | |
mkdir x86_64-pc-windows-msvc | |
cp -r /home/runner/artifacts/x86_64-pc-windows-msvc/cog.exe x86_64-pc-windows-msvc/cog.exe | |
chmod +x -R x86_64-pc-windows-msvc/cog.exe | |
cp -r /home/runner/artifacts/LICENSE/LICENSE x86_64-pc-windows-msvc/ | |
tar -czf cocogitto-x86_64-pc-windows-msvc.tar.gz x86_64-pc-windows-msvc/* | |
mkdir x86_64-apple-darwin | |
cp -r /home/runner/artifacts/x86_64-apple-darwin/cog x86_64-apple-darwin/cog | |
chmod +x -R x86_64-apple-darwin/cog | |
cp -r /home/runner/artifacts/LICENSE/LICENSE x86_64-apple-darwin/ | |
tar -czf cocogitto-x86_64-apple-darwin.tar.gz x86_64-apple-darwin/* | |
- uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: cocogitto-x86_64-unknown-linux-musl.tar.gz | |
tag: ${{ github.ref }} | |
asset_name: cocogitto-${{ github.ref_name }}-x86_64-unknown-linux-musl.tar.gz | |
- uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: cocogitto-armv7-unknown-linux-musleabihf.tar.gz | |
tag: ${{ github.ref_name }} | |
asset_name: cocogitto-${{ github.ref_name }}-armv7-unknown-linux-musleabihf.tar.gz | |
- uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: cocogitto-aarch64-unknown-linux-gnu.tar.gz | |
tag: ${{ github.ref_name }} | |
asset_name: cocogitto-${{ github.ref_name }}-aarch64-unknown-linux-gnu.tar.gz | |
- uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: cocogitto-x86_64-pc-windows-msvc.tar.gz | |
tag: ${{ github.ref_name }} | |
asset_name: cocogitto-${{ github.ref_name }}-x86_64-pc-windows-msvc.tar.gz | |
- uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: cocogitto-x86_64-apple-darwin.tar.gz | |
tag: ${{ github.ref_name }} | |
asset_name: cocogitto-${{ github.ref_name }}-x86_64-apple-darwin.tar.gz | |
docker: | |
needs: [ build ] | |
name: Docker publish cog:lastest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v3 | |
with: | |
path: ~/artifacts | |
- name: Copy artifacts to build dir | |
run: | | |
mkdir -p target/x86_64-unknown-linux-musl/release/ | |
mkdir -p target/armv7-unknown-linux-musleabihf/release/ | |
mkdir -p target/aarch64-unknown-linux-gnu/release/ | |
cp -r /home/runner/artifacts/x86_64-unknown-linux-musl target/x86_64-unknown-linux-musl/release/cog | |
cp -r /home/runner/artifacts/armv7-unknown-linux-musleabihf target/armv7-unknown-linux-musleabihf/release/cog | |
cp -r /home/runner/artifacts/aarch64-unknown-linux-gnu target/aarch64-unknown-linux-gnu/release/cog | |
chmod +x -R target/x86_64-unknown-linux-musl/release | |
chmod +x -R target/armv7-unknown-linux-musleabihf/release | |
chmod +x -R target/aarch64-unknown-linux-gnu/release | |
working-directory: ./ | |
- if: ${{ github.ref_type != 'tag' }} | |
name: Update multi-arch container latest | |
run: | | |
docker buildx build \ | |
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \ | |
-f docker/Dockerfile \ | |
-t ghcr.io/cocogitto/cog:latest . | |
- if: ${{ github.ref_type == 'tag' }} | |
name: Update multi-arch container latest | |
run: | | |
docker buildx build \ | |
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \ | |
-f docker/Dockerfile \ | |
-t ghcr.io/cocogitto/cog:${{ github.ref_name }} . |