90 lines
2.5 KiB
YAML
90 lines
2.5 KiB
YAML
name: Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: oci.pari.ng
|
|
IMAGE_NAME: library/paringboard
|
|
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
container:
|
|
image: ghcr.io/catthehacker/ubuntu:rust-latest
|
|
runs-on: docker
|
|
name: Build
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
sed -i 's/archive.ubuntu.com/ftp.kaist.ac.kr/g' /etc/apt/sources.list
|
|
apt-get update
|
|
apt-get install -y musl musl-dev musl-tools
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- uses: https://github.com/dtolnay/rust-toolchain@nightly
|
|
id: rust-toolchain
|
|
with:
|
|
targets: x86_64-unknown-linux-musl
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.rustup
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}-${{ steps.rust-toolchain.outputs.cachekey }}
|
|
- name: Build
|
|
run: cargo build --release --locked --target x86_64-unknown-linux-musl
|
|
- name: Strip
|
|
run: strip target/x86_64-unknown-linux-musl/release/paringboard
|
|
- name: Upload artifacts
|
|
uses: forgejo/upload-artifact@v4
|
|
with:
|
|
name: build-${{ matrix.name }}
|
|
path: |
|
|
target/x86_64-unknown-linux-musl/release/paringboard
|
|
docker:
|
|
runs-on: docker
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
Dockerfile
|
|
- uses: forgejo/download-artifact@v4
|
|
name: Download amd64 artifacts
|
|
with:
|
|
name: build-linux-amd64
|
|
path: linux/amd64
|
|
- name: Login to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: Dockerfile
|
|
push: true
|
|
context: "."
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
cache-from: type=gha
|
|
cache-to: type=gha
|
|
provenance: false
|
|
sbom: false
|