Skip to content

Commit

Permalink
add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
QaidVoid committed Nov 24, 2024
1 parent fa62453 commit 1516d35
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
19 changes: 19 additions & 0 deletions .github/workflows/auto-assign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto Assign
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: QaidVoid
numOfAssignee: 1
76 changes: 76 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: sbuilder release

on:
push:
tags:
- "v*.*.*"
permissions:
contents: write

jobs:
publish-binaries:
name: Publish binaries
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- {
NAME: x86_64-linux,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-musl,
}
- {
NAME: aarch64-linux,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-musl,
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated musl-tools b3sum
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.build.TOOLCHAIN }}
target: ${{ matrix.build.TARGET }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --locked --target ${{ matrix.build.TARGET }}
- name: Prepare release assets
shell: bash
run: |
mkdir -p release
cp {LICENSE,README.md} release/
cp "target/${{ matrix.build.TARGET }}/release/sbuild-linter" release/
- name: Create release artifacts
shell: bash
run: |
cp release/sbuild-linter sbuild-linter-${{ matrix.build.NAME }}
b3sum sbuild-linter-${{ matrix.build.NAME }} \
> sbuild-linter-${{ matrix.build.NAME }}.b3sum
tar -czvf sbuild-linter-${{ matrix.build.NAME }}.tar.gz \
release/
b3sum sbuild-linter-${{ matrix.build.NAME }}.tar.gz \
> sbuild-linter-${{ matrix.build.NAME }}.tar.gz.b3sum
- name: Publish to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sbuild-linter-${{ matrix.build.NAME }}*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: "sbuild-linter v${{ env.RELEASE_VERSION }}"
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Sbuilder

A repo containing the linter and builder for SBUILD packages.

## sbuild-linter
The linter validates the provided `SBUILD` package recipe, performs checks and generates the validated recipe for the builder to work with.

```sh
Usage: sbuild-linter [OPTIONS] [FILES]

Options:
--pkgver Enable pkgver mode
--no-shellcheck Disable shellcheck
--help, -h Show this help message

Files:
Specify one or more files to process.
```

## sbuilder

TODO
14 changes: 7 additions & 7 deletions sbuild-linter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ fn print_build_docs() {
);
}

fn print_usage() {
eprintln!(
"Usage: my_program [OPTIONS] [FILES]\n\n\
fn usage() -> String {
format!(
"Usage: sbuild-linter [OPTIONS] [FILES]\n\n\
Options:\n\
--pkgver Enable pkgver mode\n\
--no-shellcheck Disable shellcheck\n\
--help, -h Show this help message\n\n\
Files:\n\
Specify one or more files to process."
);
)
}

fn main() {
Expand All @@ -271,13 +271,13 @@ fn main() {
disable_shellcheck = true;
}
"--help" | "-h" => {
print_usage();
println!("{}", usage());
return;
}
arg => {
if arg.starts_with("--") {
eprintln!("Unknown argument '{}'", arg);
print_usage();
eprintln!("{}", usage());
std::process::exit(1);
} else {
files.push(arg.to_string());
Expand All @@ -287,7 +287,7 @@ fn main() {
}

if files.is_empty() {
print_usage();
eprintln!("{}", usage());
std::process::exit(1);
}

Expand Down

0 comments on commit 1516d35

Please sign in to comment.