Skip to content

Commit

Permalink
Merge pull request #724 from Shnatsel/main
Browse files Browse the repository at this point in the history
Rewrite and simplify crates.io publishing actions
  • Loading branch information
Shnatsel authored Jun 4, 2024
2 parents 44ddc74 + a357ef4 commit 9de191c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 64 deletions.
34 changes: 4 additions & 30 deletions .github/workflows/deploy_cargo_cyclonedx.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
name: Deploy cargo-cyclonedx to Crates.io

on:
workflow_dispatch:
inputs:
releaseType:
description: "cargo-cyclonedx release type (major, minor, patch)"
required: true
default: "patch"
push:
tags:
- 'cargo-cyclonedx-[0-9]+.[0-9]+.[0-9]+*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: JQ
run: |
sudo apt-get install -y jq
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Cargo bump
run: |
cargo install cargo-edit
cargo set-version --package cargo-cyclonedx --bump ${{ github.event.inputs.releaseType }}
- name: Retrieve new version
run: |
echo "::set-output name=CARGO_VERSION::$(cargo metadata | jq -r '.packages[] | select(.name == "cargo-cyclonedx") | .version')"
id: version
- name: Build one time, for sanity
run: cargo build
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cargo-cyclonedx --verbose --allow-dirty
- name: Configure git and add files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "New development bump of cargo-cylonedx to ${{steps.version.outputs.CARGO_VERSION}}"
git tag -a "cargo-cyclonedx-${{steps.version.outputs.CARGO_VERSION}}" -m "cargo-cyclonedx ${{steps.version.outputs.CARGO_VERSION}} release"
git push --follow-tags
run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cargo-cyclonedx --verbose
39 changes: 5 additions & 34 deletions .github/workflows/deploy_cyclonedx_bom.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
name: Deploy cyclonedx-bom to Crates.io

on:
workflow_dispatch:
inputs:
releaseType:
description: "cyclonedx-bom release type (major, minor, patch)"
required: true
default: "patch"
push:
tags:
- 'cyclonedx-bom-[0-9]+.[0-9]+.[0-9]+*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: JQ
run: |
sudo apt-get install -y jq
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2

- name: Cargo bump
run: |
cargo install cargo-edit
cargo set-version --package cyclonedx-bom --bump ${{ github.event.inputs.releaseType }}
- name: Retrieve new version
run: |
echo "::set-output name=CARGO_VERSION::$(cargo metadata | jq -r '.packages[] | select(.name == "cyclonedx-bom") | .version')"
id: version
- name: Build one time, for sanity
run: cargo build
- uses: dtolnay/rust-toolchain@stable
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cyclonedx-bom --verbose --allow-dirty
- name: Configure git and add files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "New development bump of cyclonedx-bom to ${{steps.version.outputs.CARGO_VERSION}}"
git tag -a "cyclonedx-bom-${{steps.version.outputs.CARGO_VERSION}}" -m "cyclonedx-bom ${{steps.version.outputs.CARGO_VERSION}} release"
git push --follow-tags
run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cyclonedx-bom --verbose

0 comments on commit 9de191c

Please sign in to comment.