Password Generator CLI - v1.0.4 #11
Workflow file for this run
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: Release | |
on: | |
release: | |
types: [published] | |
env: | |
RUSTFLAGS: -Dwarnings | |
CARGO_TERM_COLOR: always | |
BINARY_NAME: "pwdgen" | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} | |
jobs: | |
release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
rust_version: [stable] | |
include: | |
- os: macos-latest | |
os_name: "macos" | |
asset_extension: "" | |
asset_content_type: application/octet-stream | |
- os: windows-latest | |
os_name: "windows" | |
asset_extension: ".exe" | |
asset_content_type: application/octet-stream | |
- os: ubuntu-latest | |
os_name: "ubuntu" | |
asset_extension: "" | |
asset_content_type: application/octet-stream | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust_version }} | |
override: true | |
- name: Prepare Ubuntu environment | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt update | |
sudo apt install -y libxcb-shape0-dev libxcb-xfixes0-dev | |
- name: Build release | |
run: cargo build --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.BINARY_NAME }}-${{ github.event.release.tag_name }}-${{ env.BINARY_NAME }}-${{ matrix.os_name }}${{ matrix.asset_extension }}" | |
path: target/release/${{ env.BINARY_NAME }}${{ matrix.asset_extension }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./target/release/${{ env.BINARY_NAME }}${{ matrix.asset_extension }} | |
asset_name: "${{ env.BINARY_NAME }}-${{ matrix.os_name }}${{ matrix.asset_extension }}" | |
asset_content_type: ${{ matrix.asset_content_type }} | |
- name: Notify success | |
if: success() | |
run: echo "Release process completed successfully!" | |
- name: Notify failure | |
if: failure() | |
run: echo "Release process failed, check logs for details." | |
publish-crate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
- name: Publish to Crates.io | |
run: cargo publish --token ${CRATES_TOKEN} |