v2.6.1 #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: x86_64-unknown-linux-musl | |
override: true | |
components: rustfmt, clippy | |
- name: Cache cargo dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --target x86_64-unknown-linux-musl | |
- uses: actions/upload-artifact@v2 | |
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@v3 | |
- name: Create release tmp folder | |
run: mkdir -p target/x86_64-unknown-linux-musl/release | |
- uses: actions/download-artifact@v2 | |
with: | |
name: realm | |
path: target/x86_64-unknown-linux-musl/release/realm | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
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@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push images with latest(debian) | |
uses: docker/build-push-action@v2 | |
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@v2 | |
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 | |