Skip to content

Commit

Permalink
ci: fix CI publish to cargo only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
shiipou committed Sep 14, 2024
1 parent aeb04f6 commit e5761fc
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
prerelease-branches: "^(rc|beta|alpha)$"
build:
needs: get-version
if: ${{ needs.get-version.outputs.will-release }}
if: ${{ needs.get-version.outputs.will-release == 'true' }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
env:
Expand Down Expand Up @@ -100,11 +100,48 @@ jobs:

release:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release }}
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 }}"

0 comments on commit e5761fc

Please sign in to comment.