From ef0107366317694ee8b8417d03c157cba83972b9 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Mon, 3 Jun 2024 13:33:35 +0100 Subject: [PATCH 1/3] Rewrite and simplify publish action Signed-off-by: Sergey "Shnatsel" Davidoff --- .github/workflows/deploy_cargo_cyclonedx.yml | 34 +++----------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deploy_cargo_cyclonedx.yml b/.github/workflows/deploy_cargo_cyclonedx.yml index 11dabd62..00a411a3 100644 --- a/.github/workflows/deploy_cargo_cyclonedx.yml +++ b/.github/workflows/deploy_cargo_cyclonedx.yml @@ -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 --dry-run \ No newline at end of file From c9e5ec0f3c9b4a8362d8cac3339fbdfdf84e37cc Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Mon, 3 Jun 2024 13:36:24 +0100 Subject: [PATCH 2/3] No more dry run Signed-off-by: Sergey "Shnatsel" Davidoff --- .github/workflows/deploy_cargo_cyclonedx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_cargo_cyclonedx.yml b/.github/workflows/deploy_cargo_cyclonedx.yml index 00a411a3..5b657afc 100644 --- a/.github/workflows/deploy_cargo_cyclonedx.yml +++ b/.github/workflows/deploy_cargo_cyclonedx.yml @@ -12,4 +12,4 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: Publish - run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cargo-cyclonedx --verbose --dry-run \ No newline at end of file + run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --package cargo-cyclonedx --verbose \ No newline at end of file From a357ef4a31a5d221c5571e9dbf32af0b99cf4bea Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Mon, 3 Jun 2024 13:37:30 +0100 Subject: [PATCH 3/3] Rewrite cyclonedx-bom publish action in the similar vein Signed-off-by: Sergey "Shnatsel" Davidoff --- .github/workflows/deploy_cyclonedx_bom.yml | 39 +++------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy_cyclonedx_bom.yml b/.github/workflows/deploy_cyclonedx_bom.yml index c3ae6de3..672f633f 100644 --- a/.github/workflows/deploy_cyclonedx_bom.yml +++ b/.github/workflows/deploy_cyclonedx_bom.yml @@ -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 \ No newline at end of file