Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech authored Nov 7, 2024
2 parents 32298af + 1e39d96 commit 191598a
Show file tree
Hide file tree
Showing 115 changed files with 2,319 additions and 1,043 deletions.
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cd linutil
```

## 3. Make your changes

- **Edit the files you want to change**: Make your changes to the relevant files.
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.

Expand Down Expand Up @@ -60,6 +61,7 @@ cd linutil
## 11. Documentation
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
- **Automatic generation**: If you decide to add functionality through a new shell script, make sure to fill out all fields in `tab_data.toml` and run `cargo xtask docgen`.
## 12. License
Expand Down
19 changes: 13 additions & 6 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

## Supported Versions

It is recommended that you run the stable version as this is more tested and used by most. The dev branch is bleed-edge commits that are not well tested and aren't meant to be used in production environments
It is recommended that you use the stable branch as it's tested and used by most. The dev branch may contain bleeding-edge commits that are not well tested and are not meant to be used in production environments.<br>
Version tags lower than the [latest stable release](https://github.com/ChrisTitusTech/linutil/releases/latest) are **not** supported.

| Version | Supported |
| ------- | ------------------ |
| latest | :white_check_mark: |
| dev | :x: |
| Branch | Supported |
| ------- | ---------------------- |
| Stable | :white_check_mark: YES |
| Dev | :x: NO |

| Version | Supported |
| -------------------------------------------------- | ---------------------- |
| [![LATEST](https://img.shields.io/github/v/release/ChrisTitusTech/linutil?color=%230567ff&label=Latest&style=for-the-badge)](https://github.com/ChrisTitusTech/linutil/releases/latest) | :white_check_mark: YES |
| Below LATEST | :x: NO |
| Above LATEST | :x: NO |

## Reporting a Vulnerability

I'd recommend making an Issue for reporting a bug. If you would like privately submit the bug you can email me at [email protected]
If you have any reason to believe there are security vulnerabilities in Linutil, fill out the [report form](https://github.com/christitustech/linutil/security/advisories/new) or e-mail [[email protected]](mailto:[email protected]).
9 changes: 1 addition & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
ignore:
- dependency-name: "actions/stale"
versions: '>= 9'
- dependency-name: "actions/setup-python"
versions: '> 4'
- dependency-name: "crossterm"
versions: '> 0.27.0'
interval: "weekly"
29 changes: 22 additions & 7 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ changelog:
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '⚙️ Refactoring'
labels:
- 'refactor'
- title: '🧩 UI/UX'
labels:
- 'UI/UX'
- title: '📚 Documentation'
label: 'documentation'
labels:
- 'documentation'
- title: '🔒 Security'
label: 'security'
labels:
- 'security'
- title: '🧰 GitHub Actions'
label: 'github actions'
labels:
- 'github_actions'
- title: '🦀 Rust'
labels:
- 'rust'
- title: '📃 Scripting'
labels:
- 'script'
- title: 'Other Changes'
labels:
- "*"
exclude:
labels:
- 'skip-changelog'
- 'skip-changelog'
48 changes: 25 additions & 23 deletions .github/workflows/bashisms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check for bashisms
on:
pull_request:
paths:
- core/tabs/**
- 'core/tabs/**/*.sh'
merge_group:
workflow_dispatch:

Expand All @@ -15,31 +15,33 @@ jobs:
- uses: actions/checkout@v4
- run: git fetch origin ${{ github.base_ref }}

- name: Get a list of changed script files
id: get_sh_files
- name: Install devscripts
run: sudo apt-get update && sudo apt-get install -y devscripts

- name: Get changed .sh files (PR only)
id: changed-sh-files
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@v45
with:
files: '**/*.sh'

- name: Get all .sh files (if workflow dispatched)
id: sh-files
if: github.event_name != 'pull_request'
run: |
sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true)
if [ -n "$sh_files" ]; then
echo "$sh_files" > changed_files
echo "changed=1" >> $GITHUB_OUTPUT
files=$(find . -type f -name "*.sh" | tr '\n' ' ')
echo "files=${files:-none}" >> $GITHUB_ENV
- name: Set FILES for bashism check
id: set-files
run: |
if [[ "${{ steps.changed-sh-files.outputs.any_changed }}" == 'true' ]]; then
echo "FILES=${{ steps.changed-sh-files.outputs.all_changed_files }}" >> $GITHUB_ENV
else
echo "changed=0" >> $GITHUB_OUTPUT
echo "FILES=${{ env.files }}" >> $GITHUB_ENV
fi
- name: Install devscripts
if: steps.get_sh_files.outputs.changed == 1
run: sudo apt-get update && sudo apt-get install devscripts
- name: Check for bashisms
if: steps.get_sh_files.outputs.changed == 1
run: |
echo "Running for:\n$(cat changed_files)\n"
for file in $(cat changed_files); do
if [[ -f "$file" ]]; then
checkbashisms "$file"
fi
done
- name: Remove the created file
if: steps.get_sh_files.outputs.changed == 1
run: rm changed_files
IFS=' ' read -r -a file_array <<< "$FILES"
checkbashisms "${file_array[@]}"
20 changes: 15 additions & 5 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: linutil_env
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout Repository
Expand All @@ -22,13 +26,19 @@ jobs:

- name: Copy Contributing Guidelines
run: |
echo "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
echo -e "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
- uses: stefanzweifel/git-auto-commit-action@v5
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit_message: Commit Contributing Guidelines
file_pattern: "docs/contributing.md"
add_options: '--force'
commit-message: Update Contributing Guidelines
title: 'docs: Update Contributing Guidelines'
body: 'Automated update of Contributing Guidelines from .github/CONTRIBUTING.md'
branch: update-contributing-guidelines
delete-branch: true
base: main
labels: documentation
token: ${{ secrets.PAT_TOKEN }}
if: success()

- name: Setup Python
Expand Down
39 changes: 4 additions & 35 deletions .github/workflows/linutil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,9 @@ jobs:
run: cargo build --target-dir=build --release --verbose --target=x86_64-unknown-linux-musl --all-features

- name: Build aarch64 binary
run: cross build --target-dir=build --release --verbose --target=aarch64-unknown-linux-musl --all-features

- name: Move binaries to build directory
run: |
mv build/x86_64-unknown-linux-musl/release/linutil build/linutil
mv build/aarch64-unknown-linux-musl/release/linutil build/linutil-aarch64
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Commit Linutil
file_pattern: "build/linutil build/linutil-aarch64"
add_options: '--force'
if: success()
cross build --target-dir=build --release --verbose --target=aarch64-unknown-linux-musl --all-features
mv ./build/aarch64-unknown-linux-musl/release/linutil ./build/aarch64-unknown-linux-musl/release/linutil-aarch64
- name: Extract Version
id: extract_version
Expand All @@ -80,32 +70,11 @@ jobs:
append_body: true
generate_release_notes: true
files: |
./build/linutil
./build/linutil-aarch64
./build/x86_64-unknown-linux-musl/release/linutil
./build/aarch64-unknown-linux-musl/release/linutil-aarch64
./start.sh
./startdev.sh
prerelease: true
env:
version: ${{ env.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Preview
run: |
echo "$(pwd)/build" >> $GITHUB_PATH
- name: Generate preview
uses: charmbracelet/[email protected]
with:
path: "docs/assets/preview.tape"

- name: Move preview
run: |
mv preview.gif docs/assets/preview.gif
- name: Upload preview
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Preview for ${{ env.version }}
file_pattern: "docs/assets/preview.gif"
add_options: "--force"
if: success()
78 changes: 78 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: LinUtil Preview

on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name'
required: true
workflow_run:
workflows: ["LinUtil Release"]
types:
- completed

jobs:
generate_preview:
runs-on: ubuntu-latest
environment: linutil_env
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Get tag name ( Workflow Run )
id: latest_tag
uses: actions/github-script@v7
if: github.event_name == 'workflow_run'
with:
script: |
const releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
core.setOutput('result', releases.data[0].tag_name);
result-encoding: string

- name: Set tag name ( Workflow Run )
if: github.event_name == 'workflow_run'
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV

- name: Set tag name ( Workflow Dispatch )
if: ${{ github.event_name }} == 'workflow_dispatch'
run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV

- name: Download binary
run: |
curl -LO "https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/linutil"
- name: Set env
run: |
chmod +x linutil
mkdir -p build
mv linutil build/linutil
echo "${{ github.workspace }}/build" >> $GITHUB_PATH
- name: Generate preview
uses: charmbracelet/[email protected]
with:
path: "docs/assets/preview.tape"

- name: Move preview
run: mv preview.gif docs/assets/preview.gif

- name: Create PR
uses: peter-evans/[email protected]
with:
commit-message: Preview for ${{ env.tag_name }}
file-pattern: "docs/assets/preview.gif"
add-options: "--force"
token: ${{ secrets.PAT_TOKEN }}
branch: feature/preview-${{ env.tag_name }}
title: "Update preview for ${{ env.tag_name }}"
body: |
Automated PR to update preview gif for version ${{ env.tag_name }}
if: success()
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: ["main"]
paths:
- '**/*.rs'
- 'Cargo.toml'
- '**/Cargo.toml'
- 'Cargo.lock'

env:
Expand Down
Loading

0 comments on commit 191598a

Please sign in to comment.