Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite and simplify crates.io publishing actions #724

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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