cleanup pipeline #1
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
--- | |
name: Test & Build | |
on: | |
push: | |
branches: | |
- '*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yml | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
needs: test | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Branch name | |
run: echo "${GITHUB_REF##*/}" | |
- name: Get the release version from the tag | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- run: sudo apt -y install musl-dev musl-tools | |
if: matrix.build == 'linux' | |
- name: Build Linux | |
run: | | |
cargo build --release --locked --target ${{ matrix.target }} --features "openssl/vendored" | |
if: matrix.build == 'linux' | |
- name: Build | |
run: | | |
cargo build --release --locked --target ${{ matrix.target }} | |
if: matrix.build != 'linux' | |
packages: | |
name: package | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/permesi/genesis | |
- name: Docker Setup Buildx | |
uses: docker/[email protected] | |
- name: Build & Push the Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |