Skip to content

bump to 2.12.1

bump to 2.12.1 #14

Workflow file for this run

name: Rust
on:
push:
tags:
- '*'
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
packages: write
jobs:
build:
strategy:
matrix:
arch:
- { name: x86_64, target: x86_64-unknown-linux-musl }
- { name: aarch64, target: aarch64-unknown-linux-musl }
- { name: armv7, target: armv7-unknown-linux-musleabihf }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.arch.target }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.arch.target }}
use-cross: true
- name: Copy and prepare default artifact for release
if: matrix.arch.name == 'x86_64'
run: |
mkdir -p target/artifacts
cp "target/${{ matrix.arch.target }}/release/wait" "target/artifacts/wait"
- name: Copy and prepare all artifacts for release
run: |
mkdir -p target/artifacts
cp "target/${{ matrix.arch.target }}/release/wait" "target/artifacts/wait_${{ matrix.arch.name }}"
echo "Artifacts list:"
ls -latr target/artifacts/*
- name: Release
uses: softprops/action-gh-release@v1
with:
files: target/artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: wait
path: target/artifacts/*
docker:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: wait
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dockerfile
run: |
cat <<EOF > Dockerfile
FROM alpine AS builder
ARG TARGETPLATFORM
COPY . /
RUN if [ "\$TARGETPLATFORM" = "linux/amd64" ]; then mv /wait_x86_64 /wait; fi;
RUN if [ "\$TARGETPLATFORM" = "linux/arm64" ]; then mv /wait_aarch64 /wait; fi;
RUN if [ "\$TARGETPLATFORM" = "linux/arm/v7" ]; then mv /wait_armv7 /wait; fi;
RUN chmod +x /wait
FROM scratch
COPY --from=builder /wait /wait
EOF
- name: Docker metadata
id: docker-metadata
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}${{ github.event_name == 'workflow_dispatch' && format(',value={0}', github.event.inputs.version) || '' }}
type=semver,pattern={{major}}.{{minor}}${{ github.event_name == 'workflow_dispatch' && format(',value={0}', github.event.inputs.version) || '' }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64, linux/arm/v7
push: true
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}