ci: generate shell completion during regular CI tests #28
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: bugbite-cli | |
on: | |
push: | |
tags: [bugbite-cli-*] | |
branches: ['**'] | |
paths: | |
- ".github/workflows/bugbite-cli.yml" | |
workflow_dispatch: | |
jobs: | |
man: | |
runs-on: ubuntu-latest | |
container: | |
image: asciidoctor/docker-asciidoctor | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build docs | |
run: make -C doc man | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: man | |
path: target/doc/cli/man | |
if-no-files-found: error | |
retention-days: 3 | |
shellcomp: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
id: rust | |
- name: Generate files | |
run: cargo run --features shell --bin bite-shell-comp -p bugbite-cli | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shellcomp | |
path: shell | |
if-no-files-found: error | |
retention-days: 3 | |
source: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: ["man", "shellcomp"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
id: rust | |
- name: Create vendored release | |
run: .ci/vendor-release bugbite-cli | |
- name: Download generated man pages | |
uses: actions/download-artifact@v4 | |
with: | |
name: man | |
path: man | |
- name: Download generated shell completion | |
uses: actions/download-artifact@v4 | |
with: | |
name: shellcomp | |
path: shell | |
- name: Create archive | |
run: | | |
# move shell completion files into the release | |
mv man shell ${{ github.ref_name }} | |
# create the release tarball | |
tar -cv -I "xz -9 -T0" -f ${{ github.ref_name }}.tar.xz ${{ github.ref_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: source | |
path: ${{ github.ref_name }}.tar.xz | |
if-no-files-found: error | |
retention-days: 3 | |
linux: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
- powerpc64-unknown-linux-gnu | |
- powerpc64le-unknown-linux-gnu | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cross | |
run: cargo install cross --git /~https://github.com/cross-rs/cross | |
- name: Build binary | |
run: cross build --target ${{ matrix.target }} --profile release-strip -p bugbite-cli | |
- name: Create archive | |
run: | | |
tar -C target/${{ matrix.target }}/release-strip \ | |
-cv -I "xz -9 -T0" -f ${{ github.ref_name }}-${{ matrix.target }}.tar.xz \ | |
bite | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.ref_name }}-${{ matrix.target }} | |
path: ${{ github.ref_name }}-${{ matrix.target }}.tar.xz | |
if-no-files-found: error | |
retention-days: 3 | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build binary | |
run: cargo build --profile release-strip -p bugbite-cli | |
- name: Create archive | |
run: | | |
cd target/release-strip | |
zip $GITHUB_WORKSPACE/${{ github.ref_name }}-macos.zip bite | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.ref_name }}-macos | |
path: ${{ github.ref_name }}-macos.zip | |
if-no-files-found: error | |
retention-days: 3 | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: ["source", "linux", "macos"] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
artifacts/*.tar.xz | |
artifacts/${{ github.ref_name }}-macos.zip | |
fail_on_unmatched_files: true |