Skip to content

v2.6.1

v2.6.1 #47

Workflow file for this run

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag of image'
required: true
default: 'test'
push:
tags:
- v*
name: container
jobs:
build:
name: Build Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: ${{ matrix.target }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: compile
run: cross build --release --target=x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v4
with:
name: realm
path: target/x86_64-unknown-linux-musl/release/realm
build-and-push:
name: Build and push image
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create release tmp folder
run: mkdir -p target/x86_64-unknown-linux-musl/release
- uses: actions/download-artifact@v4
with:
name: realm
path: target/x86_64-unknown-linux-musl/release/realm
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Echo release version
run: echo ${{ env.RELEASE_VERSION }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images with latest(debian)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag || env.RELEASE_VERSION }}
- name: Build and push images with alpine
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.alpine
push: true
tags: ghcr.io/${{ github.repository }}:alpine, ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag || env.RELEASE_VERSION }}-alpine