refactor: Move from GitHub to Forgejo

This commit is contained in:
Awiteb 2024-03-15 06:08:33 +03:00
parent 031a8a8cf5
commit 6163c3ff26
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
31 changed files with 207 additions and 114 deletions

View file

@ -2,32 +2,28 @@
name: Bug
about: Create a bug report to help us improve Lprs
title: '[Bug]: ...'
labels: ["🐞 Bug"]
labels: ["Kind/Bug"]
assignees: ''
---
## Checks
* [ ] I added a descriptive title to this issue
* [ ] I have searched (Google, and GitHub) for similar issues and couldn't find anything
* [ ] I have read [the README](https://github.com/TheAwiteb/lprs/blob/master/README.md) and still think this is a bug
* [ ] I have searched Google for similar issues and couldn't find anything
* [ ] I have read [the README](https://git.4rs.nl/awiteb/lprs/src/branch/master/README.md) and still think this is a bug
## Version
<!-- Report for the bug only if it's present in the latest version of Lprs.
If you are not using the latest version, please update and check if the bug is still present. -->
> Then, run `rustc --version` to get the version of Rust.
Rust version: `...`
<!-- Run `rustc --version` to get the version -->
Rustc version: `...`
<!-- Run `lprs --version` to get the version, and make sure it's the latest one -->
Lprs version: `...`
## Description
<!-- A clear and concise description of what the bug is. -->
## The command
```bash
$ lprs ...
```
## Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

View file

@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for Lprs
title: '[Feature request]: ...'
labels: ["🔥 Feature"]
labels: ["Kind/Feature"]
assignees: ''
---

View file

@ -2,7 +2,7 @@
name: Question
about: Ask a question about Lprs
title: '[Question]: ...'
labels: ["💬 Question"]
labels: ["Kind/Question"]
assignees: ''
---

View file

@ -2,7 +2,7 @@
name: Typo report
about: Report a typo in the documentation or the code
title: '[Typo]: ...'
labels: ["📝 Typo"]
labels: ["Kind/Documentation"]
assignees: ''
---
@ -12,5 +12,5 @@ For the location, please provide a link to the code or the documentation.
| Location | Suggestion |
|----------|------------|
| GitHub-link| Suggestion |
| Code-link| Suggestion |

View file

@ -5,8 +5,8 @@ Make sure to replace `{issue title}` with the title of the issue you are fixing.
-->
## Issue
<!-- Copy the issue link from the issue you are fixing (e.g. https://github.com/TheAwiteb/lprs/issues/1) -->
This will fix {issue GitHub link}
<!-- Copy the issue link from the issue you are fixing (e.g. https://git.4rs.nl/awiteb/lprs/issues/1) -->
This will fix {issue Forgejo link}
## How I am fixing it
<!-- A clear and concise description of how you are fixing the bug. -->

48
.forgejo/workflows/cd.yml Normal file
View file

@ -0,0 +1,48 @@
name: CD
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
jobs:
release:
runs-on: debian
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Install git-cliff
run: |
version="2.1.2"
wget "https://github.com/orhun/git-cliff/releases/download/v$version/git-cliff-$version-x86_64-unknown-linux-gnu.tar.gz"
tar -xvzf git-cliff-*.tar.gz
mv "git-cliff-$version/git-cliff" /usr/local/bin
rm -fr git-cliff-*
- name: Write changelog
run: |
git config user.name forgejo-actions
git config user.email forgejo-actions@noreply.localhost
echo 'TAG_CHANGELOG=$(if [[ $(git tag --sort=committerdate | tail -n 1) == *"-rc"* ]]; then git-cliff --strip all $(git tag --sort=committerdate | tail -n 2 | sed ":a; N; $!ba; s/\n/../g") | sed "s/## unreleased.*$//g"; else git-cliff -l --strip all | sed "s/^## \[.*$//g";fi)' | sed "s/\"/'/g" >> $GITHUB_ENV
if [[ $(git tag --sort=committerdate | tail -n 1) != *'-rc'* ]]; then
echo "The latest tag is not a release candidate, updating changelog for $GITHUB_REF_NAME"
git-cliff > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update changelog for $GITHUB_REF_NAME"
git push
echo "Changelog updated"
else
echo "The latest tag is a release candidate, not updating changelog"
fi
- name: Create Release
uses: actions/forgejo-release@v1
with:
direction: upload
url: https://git.4rs.nl
token: ${{ env.GITHUB_TOKEN }}
release-dir: release-dir
release-notes: ${{ env.TAG_CHANGELOG }}
prerelease: ${{ contains(env.GITHUB_REF_NAME, '-rc') }}

View file

@ -0,0 +1,36 @@
name: Write changelog
on:
push:
branches:
- 'master'
jobs:
write-changelog:
runs-on: debian
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Install git-cliff
run: |
version="2.1.2"
wget "https://github.com/orhun/git-cliff/releases/download/v$version/git-cliff-$version-x86_64-unknown-linux-gnu.tar.gz"
tar -xvzf git-cliff-*.tar.gz
mv "git-cliff-$version/git-cliff" /usr/local/bin
rm -fr git-cliff-*
- name: Write changelog
run: |
git config user.name forgejo-actions
git config user.email forgejo-actions@noreply.localhost
git-cliff > CHANGELOG.md
if [[ $(git status | grep --extended-regexp '^\s+modified:\s+CHANGELOG.md$') ]]; then
git add CHANGELOG.md
git commit -m "chore(changelog): Update changelog"
git push
echo "Changelog updated"
else
echo "No changes to changelog"
fi

38
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: Rust build
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo build
rustfmt:
name: Rust format
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo fmt -- --check
check:
name: Rust check
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo check
clippy:
name: Rust clippy
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo clippy -- -D warnings

View file

@ -0,0 +1,18 @@
on:
pull_request:
types:
- opened
- edited
- reopened
jobs:
main:
runs-on: debian
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- run: |
curl -L "https://github.com/welpo/git-sumi/releases/download/v0.0.6/git-sumi-x86_64-unknown-linux-gnu.tar.xz" -o git-sumi.tar.xz
tar -xf git-sumi.tar.xz
mv git-sumi-x86_64-unknown-linux-gnu/git-sumi git-sumi
chmod +x git-sumi
./git-sumi "${{ github.event.pull_request.title }}"

1
.github/FUNDING.yml vendored
View file

@ -1 +0,0 @@
github: "TheAwiteb"

34
.github/workflows/auto_close_pr.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: Auto close PR
on:
pull_request:
types: [opened, reopened]
jobs:
close_pr:
name: Auto close PR
runs-on: ubuntu-latest
steps:
- name: Send close comment
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \
-d '{"body":"${{ env.BODY }}"}'
env:
PAT: ${{ secrets.PAT }}
BODY: This repository is mirror only and you cannot create a pull request for it. Please open your PR at https://git.4rs.nl/awiteb/lprs
- name: Close the PR
run: |
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }} \
-d '{"state":"closed"}'
env:
PAT: ${{ secrets.PAT }}

View file

@ -1,26 +0,0 @@
name: CD
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Create Release 🖋
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'pre') }}
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Publish to crates.io 🚀
uses: katyo/publish-crates@v2
with:
token: ${{ secrets.PAT }}
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

View file

@ -1,50 +0,0 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: Rust build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --workspace --all-features
rustfmt:
name: Rust format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo fmt -- --check
check:
name: Rust check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --workspace --all-features
clippy:
name: Rust clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo clippy --workspace --all-features -- -D warnings
verify_msrv:
name: Verify Minimum Supported Rust Version in Cargo.toml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install or use cached `cargo-msrv`
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-msrv
- name: Verify Minimum Rust Version
run: cargo-msrv verify

View file

@ -6,7 +6,7 @@ license = "GPL-3.0-only"
authors = ["Awiteb <a@4rs.nl>"]
readme = "README.md"
description = "A local CLI password manager"
repository = "https://github.com/TheAwiteb/lprs"
repository = "https://git.4rs.nl/awiteb/lprs"
rust-version = "1.70.0"
keywords = ["password", "manager", "CLI"]
categories = ["command-line-utilities"]

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -51,7 +51,7 @@ fn main() -> ExitCode {
println!(
"Warning: The version you are using of lprs is outdated. There is a newer version, which is `{new_version}`, and your version is `{VERSION}`
\rYou can update via: `cargo install lprs --locked`
\rOr via git repo: `cargo install --locked --git https://github.com/TheAwiteb/lprs.git`
\rOr via git repo: `cargo install --locked --git https://git.4rs.nl/awiteb/lprs.git`
\rTo disable update notification: `cargo install lprs --locked --no-default-features`\n\n"
)
}

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -67,7 +67,7 @@ pub fn lprs_version() -> LprsResult<Option<String>> {
.get("https://crates.io/api/v1/crates/lprs")
.header(
"User-Agent",
format!("Lprs <{current_time}> (https://github.com/theawiteb/lprs)"),
format!("Lprs <{current_time}> (https://git.4rs.nl/awiteb/lprs)"),
)
.send()
.map(|r| r.text())