Skip to content

Merge pull request #382 from kohbis/dependabot/cargo/url-2.5.2 #117

Merge pull request #382 from kohbis/dependabot/cargo/url-2.5.2

Merge pull request #382 from kohbis/dependabot/cargo/url-2.5.2 #117

---
name: Release and Cargo publish
on:
push:
branches:
- main
jobs:
build-test:
name: Build and test (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: swatinem/rust-cache@v2
- name: Build
run: >
cargo build
--locked
--verbose
- name: Run fmt check
run: >
cargo fmt --
--check
- name: Run tests
run: >
cargo test
--verbose
release-please:
name: Execute release chores
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
outputs:
created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.created
environment: crates.io
steps:
- uses: actions/checkout@v4
- name: Publish
run: >
cargo publish
--verbose
--locked
--token ${{ secrets.CARGO_API_KEY }}
github-release:
name: GitHub release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: release-please
if: needs.release-please.outputs.created
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
rust: [stable]
include:
- os: macos-latest
artifact_prefix: macos
target: x86_64-apple-darwin
- os: ubuntu-latest
artifact_prefix: linux
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Set toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Cargo build
run: >
cargo build
--release
--target ${{ matrix.target }}
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
strip rslack
tar czvf rslack-${{ matrix.artifact_prefix }}.tar.gz rslack
shasum -a 256 rslack-${{ matrix.artifact_prefix }}.tar.gz > rslack-${{ matrix.artifact_prefix }}.sha256
- name: Releasing assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-please.outputs.tag_name }} target/${{ matrix.target }}/release/rslack-${{ matrix.artifact_prefix }}.tar.gz
gh release upload ${{ needs.release-please.outputs.tag_name }} target/${{ matrix.target }}/release/rslack-${{ matrix.artifact_prefix }}.sha256