diff --git a/.github/workflows/pkgs.yml b/.github/workflows/pkgs.yml index 492653d..27d764d 100644 --- a/.github/workflows/pkgs.yml +++ b/.github/workflows/pkgs.yml @@ -35,3 +35,39 @@ jobs: with: name: deb path: bashpass_${{ env.RELEASE_VERSION }}_all.deb + + build-rpm: + runs-on: ubuntu-latest + + steps: + - name: Set env + run: | + printf 'RELEASE_VERSION=%s' "${GITHUB_REF#refs/*/v}" >> ${GITHUB_ENV} + + - uses: actions/checkout@v3 + with: + path: bashpass-${{ env.RELEASE_VERSION }} + ref: refs/tags/v${{env.RELEASE_VERSION }} + + - name: Install required packages + run: | + /usr/bin/sudo /usr/bin/apt update + /usr/bin/sudo /usr/bin/apt install -y rpm + + - name: Build RPM + run: | + /usr/bin/sed -i "s/RELEASE_VERSION/${{ env.RELEASE_VERSION }}/" bashpass-${{ env.RELEASE_VERSION }}/pkgs/rpm/bashpass.spec + + /usr/bin/mkdir -pv ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + /usr/bin/cp -r bashpass-${{ env.RELEASE_VERSION }}/pkgs/rpm/bashpass.spec ~/rpmbuild/SPECS/ + + /usr/bin/tar -czf "bashpass-${{ env.RELEASE_VERSION }}.tar.gz" "bashpass-${{ env.RELEASE_VERSION }}" + /usr/bin/mv -v "bashpass-${{ env.RELEASE_VERSION }}.tar.gz" ~/rpmbuild/SOURCES/ + + /usr/bin/rpmbuild -bb ~/rpmbuild/SPECS/bashpass.spec + /usr/bin/cp -rv ~/rpmbuild/RPMS/noarch/* . + + - uses: actions/upload-artifact@v3 + with: + name: rpm + path: bashpass-${{ env.RELEASE_VERSION }}-1.noarch.rpm diff --git a/pkgs/rpm/bashpass.spec b/pkgs/rpm/bashpass.spec new file mode 100644 index 0000000..ddaa60d --- /dev/null +++ b/pkgs/rpm/bashpass.spec @@ -0,0 +1,43 @@ +Name: bashpass +Version: RELEASE_VERSION +Release: 1 +BuildArch: noarch +Summary: A command-line based password manager written in Bash. + +License: MIT +URL: https://github.com/AntonVanAssche/BashPass +Source0: https://github.com/AntonVanAssche/BashPass/archive/refs/tags/%{name}-%{version}.tar.gz + +Requires: bash gnupg2 + +%description +BashPass is a command-line based password manager written in Bash. +It uses GPG to encrypt/decrypt the files where the passwords are stored . +This means the passwords are 100% stored locally, so you don't have to trust a third party to store your passwords. + +%prep +%autosetup + +%install +rm -rf %{buildroot} + +%{__mkdir_p} %{buildroot}%{_bindir} +%{__mkdir_p} %{buildroot}%{_mandir}/man1 +%{__install} -m 0755 %{name} %{buildroot}%{_bindir}/%{name} +%{__install} -m 0644 docs/man/%{name}.1.gz %{buildroot}%{_mandir}/man1/%{name}.1.gz +%{__install} -m 0644 docs/man/%{name}.conf.1.gz %{buildroot}%{_mandir}/man1/%{name}.conf.1.gz + +%clean +rm -rf %{buildroot} + +%files +%{_bindir}/%{name} + +%doc +%{_mandir}/man1/%{name}.1.gz +%{_mandir}/man1/%{name}.conf.1.gz + +%license LICENSE.md + +%changelog +%autochangelog