Skip to content

chore: Bump version to 0.14.1 #41

chore: Bump version to 0.14.1

chore: Bump version to 0.14.1 #41

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
is_pre: ${{ steps.release_type.outputs.is_pre }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Conventional Commit Changelog
id: conventional_commits
shell: bash
run: |
curl -s -L -o./clog.tar.gz https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-x86_64-unknown-linux-musl.tar.gz
tar -xf ./clog.tar.gz
chmod +x ./clog
# delete current tag locally
git tag -d "$GITHUB_REF_NAME"
if [[ "$GITHUB_REF_NAME" == *"-"* ]]; then
last_tag="$(git tag -l --sort version:refname | tail -n1)"
else
last_tag="$(git tag -l --sort version:refname | grep -v -- - | tail -n1)"
fi
printf 'Using %s as last tag\n' "$last_tag"
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
./clog --from="$last_tag" --setversion="$GITHUB_REF_NAME" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Determine release type
id: release_type
shell: bash
run: |
is_pre='false'
[[ "$GITHUB_REF_NAME" == *"-"* ]] && is_pre='true'
printf 'is_pre=%s\n' "$is_pre" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: ${{ steps.release_type.outputs.is_pre }}
body: ${{ env.CHANGELOG }}
token: ${{ secrets.GITHUB_TOKEN }}
lint:
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
features: [default, all]
steps:
- uses: actions/checkout@v4
- name: Install Rust Toolchain
id: rust_toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: lint-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ matrix.features }}-git-${{ github.sha }}
restore-keys: |
lint-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ matrix.features }}-
lint-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-
lint-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-
lint-${{ runner.os }}-
- name: rustfmt
shell: bash
run: |
cargo fmt -- --check
- name: Clippy
shell: bash
run: |
cargo clippy --features=${{ matrix.features }} --locked -- -D warnings
cargo clippy --features=${{ matrix.features }} --locked --tests -- -D warnings
test:
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
features:
- [default]
- [all]
- [notification, encryption, yubikey]
steps:
- uses: actions/checkout@v4
- name: Install Rust Toolchain
id: rust_toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: test-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ join(matrix.features, '+') }}-git-${{ github.sha }}
restore-keys: |
test-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ join(matrix.features, '+') }}-
test-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-
test-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-
test-${{ runner.os }}-
- name: Test
shell: bash
run: |
cargo test --release --features=${{ join(matrix.features) }}
build:
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
features: [default, all]
steps:
- uses: actions/checkout@v4
- name: Install macOS Dependencies
if: contains(matrix.os, 'macos')
run: |
brew install coreutils gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- name: Install Windows Dependencies
if: contains(matrix.os, 'windows')
run: choco install zip
- name: Install Rust Toolchain
id: rust_toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Add macOS Targets
if: contains(matrix.os, 'macos')
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: build-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ matrix.features }}-git-${{ github.sha }}
restore-keys: |
build-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-features-${{ matrix.features }}-
build-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-lock-${{ hashFiles('Cargo.lock') }}-
build-${{ runner.os }}-rustc-${{ steps.rust_toolchain.outputs.cachekey }}-
build-${{ runner.os }}-
- name: "Build (Linux/Windows)"
if: "!contains(matrix.os, 'macos')"
shell: bash
run: |
cargo build --release --features=${{ matrix.features }}
- name: "Build (macOS x86_64)"
if: contains(matrix.os, 'macos')
shell: bash
run: |
cargo build --release --features=${{ matrix.features }} --target=x86_64-apple-darwin
- name: "Build (macOS aarch64)"
if: contains(matrix.os, 'macos')
shell: bash
run: |
cargo build --release --features=${{ matrix.features }} --target=aarch64-apple-darwin
- name: macOS Universal Binary
if: contains(matrix.os, 'macos')
run: |
mkdir -p target/release/
lipo -create -output target/release/git-credential-keepassxc target/x86_64-apple-darwin/release/git-credential-keepassxc target/aarch64-apple-darwin/release/git-credential-keepassxc
file target/release/git-credential-keepassxc
- name: Determine artifact name suffix
id: artifact_suffix
if: "matrix.features == 'default' || matrix.features == 'all'"
shell: bash
run: |
case "${{ matrix.features }}" in
default)
printf 'suffix=%s\n' 'minimal' >> $GITHUB_OUTPUT
;;
all)
printf 'suffix=%s\n' 'full' >> $GITHUB_OUTPUT
;;
*)
exit 1
;;
esac
- name: Pack
id: pack
shell: bash
run: |
zip -j "./${{ matrix.os }}-${{ steps.artifact_suffix.outputs.suffix }}.zip" target/release/git-credential-keepassxc target/release/git-credential-keepassxc.exe
echo "filename=${{ matrix.os }}-${{ steps.artifact_suffix.outputs.suffix }}" >> $GITHUB_OUTPUT
- name: "Hash (Unix)"
if: "!contains(matrix.os, 'windows')"
run: |
echo "$(sha256sum ${{ steps.pack.outputs.filename }}.zip | cut -d ' ' -f 1)" > ${{ steps.pack.outputs.filename }}.zip.sha256sum
cat ${{ steps.pack.outputs.filename }}.zip.sha256sum
- name: "Hash (Windows)"
if: contains(matrix.os, 'windows')
run: |
$FileHash=(certutil -hashfile ${{ steps.pack.outputs.filename }}.zip SHA256 | findstr /v hash | findstr /v SHA).replace(" ", "")
echo "$FileHash"
echo "$FileHash" > ${{ steps.pack.outputs.filename }}.zip.sha256sum
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ steps.pack.outputs.filename }}.zip
asset_name: ${{ steps.pack.outputs.filename }}.zip
asset_content_type: application/zip
- name: Upload Hash
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ steps.pack.outputs.filename }}.zip.sha256sum
asset_name: ${{ steps.pack.outputs.filename }}.zip.sha256sum
asset_content_type: text/plain
publish_release:
runs-on: ubuntu-latest
needs: [create_release, lint, test, build]
if: ${{ needs.create_release.outputs.is_pre == 'false' }}
steps:
- name: Publish Release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create_release.outputs.release_id }}