Skip to content

ci: bump actions/download-artifact from 7.0.0 to 8.0.1 #13

ci: bump actions/download-artifact from 7.0.0 to 8.0.1

ci: bump actions/download-artifact from 7.0.0 to 8.0.1 #13

name: Publish mows binary
on:
push:
tags:
- 'mows-cli-v*'
paths:
- 'utils/mows-cli/**'
- 'utils/mows-common-rust/**'
- '.github/workflows/publish-mows-cli.yml'
pull_request:
paths:
- 'utils/mows-cli/**'
- 'utils/mows-common-rust/**'
- '.github/workflows/publish-mows-cli.yml'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (do not publish release)'
required: false
default: 'false'
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Install Rust
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable
with:
toolchain: stable
- name: Cache cargo registry
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: Run unit tests
run: cargo test -p mows-cli --release
- name: Build release binary for e2e tests
run: cargo build -p mows-cli --release
- name: Create mpm symlink for e2e tests
run: ln -sf mows target/release/mpm
- name: Run e2e tests
run: |
cd utils/mows-cli/tests
# Use mock Docker client for tests that would otherwise need Docker daemon
# Skip test-self-update which requires network access to GitHub API
SKIP_TESTS="test-self-update" ./run-all.sh
env:
MOWS_BIN: ${{ github.workspace }}/target/release/mows
MPM_BIN: ${{ github.workspace }}/target/release/mpm
MPM_MOCK_DOCKER: "1"
build:
needs: test
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
os_name: linux
- arch: arm64
os_name: linux
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Get git info
id: git_info
run: |
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "date=$(git log -1 --format=%cs)" >> $GITHUB_OUTPUT
- name: Build static binary using Docker
env:
GIT_HASH: ${{ steps.git_info.outputs.hash }}
GIT_DATE: ${{ steps.git_info.outputs.date }}
TARGETARCH: ${{ matrix.arch }}
BUILDX_CACHE: gha
run: |
cd utils/mows-cli
bash build.sh
- name: Get version from tag
id: get_version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#mows-cli-v}"
else
VERSION="dev"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Rename binary with version and platform
run: |
cd utils/mows-cli/dist
# Remove symlink, keep only the real binary
rm -f mpm
mv mows mows-${{ steps.get_version.outputs.version }}-${{ matrix.os_name }}-${{ matrix.arch }}
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4
with:
name: mows-${{ matrix.os_name }}-${{ matrix.arch }}
path: utils/mows-cli/dist/mows-*
retention-days: 7
release:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event.inputs.dry_run != 'true'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
path: artifacts
merge-multiple: true
- name: Get version from tag
id: get_version
run: |
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#mows-cli-v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create checksums
run: |
cd artifacts
for f in mows-*; do
sha256sum "$f" > "${f}-checksum-sha256.txt"
done
- name: Create GitHub Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
name: mows v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
files: |
artifacts/mows-*
generate_release_notes: true