Files
dependabot[bot] 8d439ebe38 Bump actions/upload-artifact from 5 to 6
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-15 05:12:24 +00:00

133 lines
4.2 KiB
YAML

name: Publish
on:
push:
branches:
- master
tags:
- "v*.*.*"
pull_request:
jobs:
publish:
name: Publish for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: oha
release_name: oha-linux-amd64
target: x86_64-unknown-linux-musl
additional_args: "--features vsock"
use_cross: false
- os: windows-latest
artifact_name: oha.exe
release_name: oha-windows-amd64.exe
target: x86_64-pc-windows-msvc
additional_args: ""
use_cross: false
- os: macos-latest
artifact_name: oha
release_name: oha-macos-amd64
target: x86_64-apple-darwin
additional_args: ""
use_cross: false
- os: ubuntu-latest
artifact_name: oha
release_name: oha-linux-arm64
target: aarch64-unknown-linux-musl
additional_args: "--features vsock"
use_cross: true
- os: macos-14
artifact_name: oha
release_name: oha-macos-arm64
target: aarch64-apple-darwin
additional_args: ""
use_cross: false
env:
BUILD_CMD: cargo
steps:
- uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v6
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.target, 'musl')
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
uses: taiki-e/install-action@v2
with:
tool: cross
- uses: Swatinem/rust-cache@v2
- name: Overwrite build command env variable
if: matrix.use_cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- name: Build
shell: bash
run: $BUILD_CMD build --profile release-ci --target ${{ matrix.target }} --locked --no-default-features --features rustls ${{ matrix.additional_args }}
- name: Upload
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.release_name }}
path: target/${{ matrix.target }}/release-ci/${{ matrix.artifact_name }}
- name: Upload binaries to release
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release-ci/${{ matrix.artifact_name }}
asset_name: ${{ matrix.release_name }}
tag: ${{ github.ref }}
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max