fix(ci): rename workflow to publish-mows-cli.yml #1
Workflow file for this run
This file contains hidden or 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: Publish mows binary | |
| on: | |
| push: | |
| tags: | |
| - 'mows-cli-v*' | |
| paths: | |
| - 'utils/mpm/**' | |
| - 'utils/mows-common-rust/**' | |
| - '.github/workflows/publish-mows-cli.yml' | |
| pull_request: | |
| paths: | |
| - 'utils/mpm/**' | |
| - '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 | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable | |
| with: | |
| toolchain: stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| utils/mpm/target | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('utils/mpm/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-test- | |
| - name: Run unit tests | |
| run: | | |
| cd utils/mpm | |
| cargo test --release | |
| - name: Build release binary for e2e tests | |
| run: | | |
| cd utils/mpm | |
| cargo build --release | |
| - name: Create mpm symlink for e2e tests | |
| run: | | |
| ln -sf mows utils/mpm/target/release/mpm | |
| - name: Run e2e tests | |
| run: | | |
| cd utils/mpm/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 }}/utils/mpm/target/release/mows | |
| MPM_BIN: ${{ github.workspace }}/utils/mpm/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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 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/mpm | |
| 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/mpm/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/mpm/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@37930b1c2abaa49bbe596cd826c3c89aef350131 # 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 |