Skip to content

fix(deps): update rust crate clap to v4.5.6 #202

fix(deps): update rust crate clap to v4.5.6

fix(deps): update rust crate clap to v4.5.6 #202

name: Build and publish docker image
on:
push:
branches:
- main
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
# see #73
- target: aarch64-apple-darwin
# see #74
runner: macos-latest
name: Build binary
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@master
with:
submodules: recursive
fetch-depth: '0'
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
target: ${{ matrix.target }}
- name: Build artifact
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
- name: Debug output
run: |
du '${{ github.workspace }}/target/${{ matrix.target }}/release/chunk-search-rs'
file '${{ github.workspace }}/target/${{ matrix.target }}/release/chunk-search-rs'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bin_${{ matrix.target }}
path: ${{ github.workspace }}/target/${{ matrix.target }}/release/chunk-search-rs
push_tag:
needs: build
runs-on: ubuntu-latest
name: Push tag
outputs:
new_tag: ${{ steps.bump_version.outputs.new_tag }}
steps:
# to push tag correctly, entire history is needed!!
- uses: actions/checkout@master
with:
submodules: recursive
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: "patch"
WITH_V: true
DEFAULT_BRANCH: "main"
id: bump_version
release:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-apple-darwin
needs: push_tag
runs-on: ubuntu-latest
name: Release
steps:
- name: Download
uses: actions/download-artifact@v4
id: download
with:
name: bin_${{ matrix.target }}
path: ${{ github.workspace }}
- name: Debug output of downloaded artifact
run: |
find '${{ steps.download.outputs.download-path }}' -type f
- name: Prepare release
run: |
mv ${{ github.workspace }}/chunk-search-rs ${{ github.workspace }}/chunk-search-rs_${{ matrix.target }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ github.workspace }}/chunk-search-rs_${{ matrix.target }}
draft: false
prerelease: false
tag_name: ${{ needs.push_tag.outputs.new_tag }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-docker-image:
runs-on: ubuntu-latest
env:
image_name: chunk-search-rs
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: '0'
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.image_name }}
tags: |
type=sha,prefix=sha-,suffix=,format=short
type=raw,value=latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/single-target/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max