Skip to content

Merge pull request #271 from ikatson/infohash-only-url #54

Merge pull request #271 from ikatson/infohash-only-url

Merge pull request #271 from ikatson/infohash-only-url #54

Workflow file for this run

name: Release binaries for Linux and Docker
on:
push:
branches:
- main
tags:
- "v*.*.*"
jobs:
build-docker-cross:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
platform: [linux/arm/v7, linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: builder1
- name: Cache
uses: actions/cache@v4
id: cache
with:
path: |
usr-local-cargo-git-db
usr-local-cargo-registry-cache
usr-local-cargo-registry-index
src-target
key: docker-xx-v1-${{ matrix.platform }}-release
save-always: true
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"usr-local-cargo-git-db": "/usr/local/cargo/git/db",
"usr-local-cargo-registry-cache": "/usr/local/cargo/registry/cache",
"usr-local-cargo-registry-index": "/usr/local/cargo/registry/index",
"src-target": "/src/target"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: cross-compile the binary
run: |
set -e
mkdir -p target/cross
docker buildx ls
mkdir -p target/cross/${{ matrix.platform }}
docker build --builder ${{ steps.builder1.outputs.name }} \
--platform ${{ matrix.platform }} \
-f docker/Dockerfile.xx \
--output type=local,dest=target/cross/${{ matrix.platform }} ./
- name: list files
run: find target/cross/
- name: generate-archive-key
id: gen_artifact_key
run: |
echo "key=$(echo ${{ matrix.platform }} | tr '/' '-')" >> "$GITHUB_OUTPUT"
- name: copy binary for release
run: |
cd target/cross
cp -l ${{ matrix.platform }}/rqbit rqbit-${{ steps.gen_artifact_key.outputs.key }}
- uses: softprops/action-gh-release@v1
if: ${{ github.ref_type == 'tag' }}
with:
generate_release_notes: true
files: |
target/cross/rqbit-${{ steps.gen_artifact_key.outputs.key }}
- name: Archive target/cross/
uses: actions/upload-artifact@v4
with:
name: ${{ steps.gen_artifact_key.outputs.key }}
path: target/cross/${{ matrix.platform }}/rqbit
build-push-docker-multiarch:
runs-on: ubuntu-latest
needs: build-docker-cross
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ikatson/rqbit
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: actions/download-artifact@v4
with:
name: linux-arm-v7
path: target/cross/linux/arm/v7/
- uses: actions/download-artifact@v4
with:
name: linux-arm64
path: target/cross/linux/arm64/
- uses: actions/download-artifact@v4
with:
name: linux-amd64
path: target/cross/linux/amd64/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
context: target/cross/
file: docker/Dockerfile