Skip to content

Commit

Permalink
fix(ci): add commit msg
Browse files Browse the repository at this point in the history
ci(release): gen completions
  • Loading branch information
saying121 committed Apr 29, 2024
1 parent 78edd8e commit 539c9c7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout/@v4

- uses: dtolnay/rust-toolchain@master
with:
# my rustfmt config use many nightly features
Expand Down
58 changes: 38 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run:
cargo release publish --allow-branch HEAD --no-confirm --workspace -x
cargo release publish --allow-branch HEAD --no-confirm --workspace -x || echo "No crates publish."

create-release:
# needs: [publish]
Expand Down Expand Up @@ -141,25 +141,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get sha-commit from tag
id: get_baseline_sha
shell: bash
run: |
latest_sha=$(git rev-list --tags --max-count=1)
echo "sha_tag=$latest_sha" >> "$GITHUB_OUTPUT";

- name: Install Dbus
if: ${{ !matrix.cross && startsWith(matrix.os, 'ubuntu-') }}
run: sudo apt update && sudo apt install libdbus-1-dev pkg-config

- name: Checkout source code to specific tag
uses: actions/checkout@v4
with:
ref: ${{ steps.get_baseline_sha.outputs.sha_tag }}

- name: Install Nightly Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand Down Expand Up @@ -189,16 +175,48 @@ jobs:
# ref: refs/tags/${{ needs.get-version.outputs.tag_version }}
checksum: sha256

- name: Generate completions
- name: tar
if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu' }}
run: |
./target/x86_64-unknown-linux-gnu/release/lcode --generate=zsh | tee ./completions/_lcode
./target/x86_64-unknown-linux-gnu/release/lcode --generate=bash | tee ./completions/lcode.bash
./target/x86_64-unknown-linux-gnu/release/lcode --generate=fish | tee ./completions/lcode.fish
cp ./target/x86_64-unknown-linux-gnu/release/lcode ./lcode
tar -cvf lcode.tar ./lcode
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu' }}
with:
name: lcode.tar
path: lcode.tar

completions:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout/@v4

- uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Generate completions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
completions(generated): update completions
run: |
tar -xvf lcode.tar
# git checkout main
./lcode --generate=zsh >./completions/_lcode
./lcode --generate=bash >./completions/lcode.bash
./lcode --generate=fish >./completions/lcode.fish
git config user.email "actions@github"
git config user.name "Github Actions"
git remote set-url origin https://x-access-token:"${GITHUB_TOKEN}"@github.com/"${GITHUB_REPOSITORY}".git
git add completions/
git tag
git log 2
echo "${GITHUB_REF}"
# shellcheck disable=SC2015
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:"${GITHUB_REF}")
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push --verbose)
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.1] - 2024-04-28

### Fixed

- Cli: `lcode fzy detail` and `lcode generate` help

## [0.8.0] - 2024-04-28

### Added
Expand Down

0 comments on commit 539c9c7

Please sign in to comment.