Skip to content

ci: fix CI publish to cargo only when needed #32

ci: fix CI publish to cargo only when needed

ci: fix CI publish to cargo only when needed #32

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

No steps defined in `steps` and no workflow called in `uses` for the following jobs: publish
on:
push:
branches:
- main
- rc
- beta
- alpha
permissions:
contents: write
jobs:
get-version:
uses: shiipou/github-actions/.github/workflows/get-version.yml@main
with:
prerelease-branches: "^(rc|beta|alpha)$"
build:
needs: get-version
if: ${{ needs.get-version.outputs.will-release == 'true' }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
env:
VERSION: ${{ needs.get-version.outputs.version }}
strategy:
matrix: # Need to find what's the best target for `x86-x64-linux` and remove the others (gnu or musl)
include:
- target: aarch64-unknown-linux-musl
os: linux
arch: aarch64
runner: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: linux
arch: x86_64
runner: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows
arch: x86_64
runner: windows-latest
file_extension: '.exe'
- target: aarch64-pc-windows-msvc
os: windows
arch: aarch64
runner: windows-latest
file_extension: '.exe'
- target: x86_64-apple-darwin
os: macos
arch: x86_64
runner: macos-latest
- target: aarch64-apple-darwin
os: macos
arch: aarch64
runner: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: Set version
uses: actions-rs/cargo@v1
with:
command: set-version
args: ${{ env.VERSION }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release -F cli --target ${{ matrix.target }}
- name: Rename artifact to platform specific name
run: |
mv target/${{ matrix.target }}/release/clone${{ matrix.file_extension }} ./clone-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: clone-${{ matrix.os }}-${{ matrix.arch }}
path: ./clone-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
release:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release == 'true' }}
uses: shiipou/github-actions/.github/workflows/release.yml@main
with:
version: ${{ needs.get-version.outputs.version }}
changelogs: ${{ needs.get-version.outputs.changelogs }}
is-prerelease: ${{ needs.get-version.outputs.is-prerelease == 'true' }}
download-artifacts: true
assets: artifacts/**/*
publish:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release == 'true' }}
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.get-version.outputs.version }}
jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: Set version
uses: actions-rs/cargo@v1
with:
command: set-version
args: ${{ env.VERSION }}
- name: Build target
uses: actions-rs/cargo@v1
with:
command: publish
args: -p clone-project-manager --allow-dirty --token "${{ secrets.CARGO_TOKEN }}"