Skip to content

fix: Publish docker image in the same workflow #1

fix: Publish docker image in the same workflow

fix: Publish docker image in the same workflow #1

Workflow file for this run

name: Build and Release
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- LICENSE
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.bump.outputs.bumped }}
changed-files: ${{ steps.bump.outputs.changed-files }}
new-version: ${{ steps.bump.outputs.new-version }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/bump-version-action@v2
id: bump
with:
no-node: true
- uses: prantlf/shelve-changes-action@v1
- run: make lint build
- uses: prantlf/shelve-output-action@v2
if: ${{ steps.bump.outputs.bumped == 'true' }}
with:
name: litevec
path: target/release/litevec
linux-arm:
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: |
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe' | sudo tee -a /etc/apt/sources.list
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe' | sudo tee -a /etc/apt/sources.list
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe' | sudo tee -a /etc/apt/sources.list
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe' | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture arm64
sudo apt-get update || true
sudo apt-get -y install gcc-aarch64-linux-gnu libssl3 libssl-dev libssl-dev:arm64
- run: rustup target add aarch64-unknown-linux-gnu
- run: make build LINUX_ARM=1
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
arch: arm64
name: litevec
path: target/aarch64-unknown-linux-gnu/release/litevec
macos:
needs:
- linux
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: make build
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
name: litevec
path: target/release/litevec
macos-arm:
needs:
- linux
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: rustup target add aarch64-apple-darwin
- run: make build MACOS_ARM=1
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
arch: arm64
name: litevec
path: target/aarch64-apple-darwin/release/litevec
windows:
needs:
- linux
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: cmd /c make-build.bat
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
name: litevec
path: target/release/litevec.exe
- run: |
rustup target add aarch64-pc-windows-msvc
cmd /c make-build.bat WINDOWS_ARM
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
arch: arm64
name: litevec
path: target/aarch64-pc-windows-msvc/release/litevec.exe
windows-arm:
needs:
- linux
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: rustup target add aarch64-pc-windows-msvc
- run: cmd /c make-build.bat WINDOWS_ARM
- uses: prantlf/shelve-output-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
arch: arm64
name: litevec
path: target/aarch64-pc-windows-msvc/release/litevec.exe
docker:
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- uses: docker/build-push-action@v5
with:
push: false
release:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
- linux-arm
- macos
- macos-arm
- windows
- windows-arm
- docker
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: prantlf/unshelve-changes-action@v1
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- uses: prantlf/unshelve-output-action@v5
with:
name: litevec
- uses: prantlf/finish-release-action@v1
with:
no-node: true
debug: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker-publish:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
- release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prantlf/unshelve-changes-action@v1
with:
files: ${{ needs.linux.outputs.changed-files }}
- uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/prantlf/litevec
tags: |
type=semver,pattern={{version}},value=v${{ needs.linux.outputs.new-version }}
type=semver,pattern={{major}}.{{minor}},value=v${{ needs.linux.outputs.new-version }}
type=semver,pattern={{major}},value=v${{ needs.linux.outputs.new-version }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}