Fix logging when log level is selected from config (#350) #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish_sdk | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
CARGO_TERM_COLOR: always | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if iggy/Cargo.toml and Cargo.lock are changed | |
uses: tj-actions/changed-files@v40 | |
id: all_changed_files | |
with: | |
files: | | |
Cargo.lock | |
iggy/Cargo.toml | |
- name: Extract iggy version from Cargo.toml | |
if: ${{ steps.all_changed_files.outputs.all_changed_files == 'Cargo.lock iggy/Cargo.toml' }} | |
id: extract_version | |
run: | | |
version=$(cargo pkgid -p iggy | cut -d# -f2 | cut -d: -f2) | |
echo "iggy_version=$version" >> "$GITHUB_OUTPUT" | |
echo "::notice ::Version from Cargo.toml $version" | |
- name: Check if version is a Git tag | |
uses: mukunku/[email protected] | |
if: ${{ steps.all_changed_files.outputs.all_changed_files == 'Cargo.lock iggy/Cargo.toml' }} | |
id: check_git_tag | |
with: | |
tag: "iggy-${{ steps.extract_version.outputs.iggy_version }}" | |
- name: Print message | |
if: ${{ steps.check_git_tag.outputs.exists == 'true' }} | |
run: | | |
echo "::notice ::Tag iggy-${{ steps.extract_version.outputs.iggy_version }} exists, skipping tag creation" | |
- name: Create tag | |
if: ${{ steps.check_git_tag.outputs.exists == 'false' }} | |
id: tagging | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git tag -a iggy-${{ steps.extract_version.outputs.iggy_version }} -m "iggy-${{ steps.extract_version.outputs.iggy_version }}" | |
git push origin iggy-${{ steps.extract_version.outputs.iggy_version }} | |
echo "::notice ::Created iggy-${{ steps.extract_version.outputs.iggy_version }} tag" | |
echo "tag_created=true" >> "$GITHUB_OUTPUT" | |
outputs: | |
iggy_version: ${{ steps.extract_version.outputs.iggy_version }} | |
tag_created: ${{ steps.tagging.outputs.tag_created }} | |
publish: | |
name: Publish SDK on crates.io | |
needs: tag | |
if: ${{ needs.tag.outputs.tag_created == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: publish | |
run: | | |
cargo login "${{ secrets.CARGO_REGISTRY_TOKEN }}" | |
cargo publish -p iggy | |
finalize: | |
runs-on: ubuntu-latest | |
needs: | |
- publish | |
if: always() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Everything is fine | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Something went wrong | |
if: ${{ contains(needs.*.result, 'failure') }} | |
uses: JasonEtco/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_BOT_CONTEXT_STRING: "publish to crates.io" | |
with: | |
filename: .github/ISSUE_TEMPLATE.md |