Skip to content

Commit

Permalink
Merge pull request #13 from thales-maciel/aur
Browse files Browse the repository at this point in the history
trying to deploy to aur
  • Loading branch information
thales-maciel committed Jun 26, 2023
2 parents 26abb06 + ffced6c commit 6621bf6
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
42 changes: 41 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,47 @@ jobs:
cargo build -r
cargo publish --token ${CRATES_TOKEN}
publish_to_aur:
name: Publish to aur
needs: ["check_nix", "extract_version", "create_release"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Print target version
run: |
echo Using version v${{ needs.extract_version.outputs.version }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Build binary
run: nix build
- uses: actions/upload-artifact@v2
name: "Upload artifacts"
with:
name: Binary
path: |
result/bin/dott
- name: Upload artifacts to GH releases
run: |
gh release upload v${{ needs.extract_version.outputs.version }} \
result/bin/dott
- name: Generate PKGBUILD
run: |
export DOTT_CHECKSUM=sha512sum result/bin/dott | cut -d' ' -f1
export README_CHECKSUM=sha512sum README.md | cut -d' ' -f1
RELEASE_TAG={{ needs.extract_version.outputs.version }} ./ci/generate-pkgbuild.py
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.2.3
with:
pkgname: dott-rs
pkgbuild: ./pkgbuild/dott-rs-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: v${{ needs.extract_version.outputs.version }}



linux_deb:
name: Linux Debian Release
needs: ["check_nix", "extract_version", "create_release"]
Expand All @@ -116,7 +157,6 @@ jobs:
nix develop
cargo install cargo-deb --version 1.34.0
cargo-deb
ls target/debian
- uses: actions/upload-artifact@v2
name: "Upload artifacts"
with:
Expand Down
46 changes: 46 additions & 0 deletions ci/generate-pkgbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /usr/bin/env python3
from os import environ, makedirs

release_tag = environ.get('RELEASE_TAG')
if not release_tag:
print('::error ::RELEASE_TAG is required but missing')
exit(1)

dott_checksum = environ.get('DOTT_CHECKSUM')
if not dott_checksum:
print('::error ::DOTT_CHECKSUM is required but missing')
exit(1)

readme_checksum = environ.get('README_CHECKSUM')
if not readme_checksum:
print('::error ::README_CHECKSUM is required but missing')
exit(1)

maintainer = '# Maintainer: Thales Maciel <contato@thalesmaciel.com>\n'

opening = maintainer + '\n This file is automatically generated. Do not edit.\n'

print('Generating PKGBUILD for dott-rs...')

makedirs('./pkgbuild/dott-rs-bin', exist_ok=True)
with open('./pkgbuild/dott-rs-bin/PKGBUILD', 'w') as pkgbuild:
content = opening + '\n'
content += 'pkgname=dott-rs-bin\n'
content += '_pkgname=dott\n'
content += f'pkgver={release_tag}\n'
content += f'pkgrel=1\n'
content += 'pkgdesc="The dotfile manager you never knew you didn\'n need"\n'
content += 'arch=(x86_64)\n'
content += 'url="https://github.com/thales-maciel/dott"\n'
content += 'license=("MIT")\n'
content += 'conflicts=("$_pkgname" "${pkgname%-bin}")\n'
content += 'provides=("${pkgname%-bin}")\n'
content += 'source_x86_64=("$pkgname-$pkgver::$url/releases/download/v$pkgver/$_pkgname" "$pkgname-$pkgver-README.md::$url/raw/v$pkgver/README.md")\n'
content += f"sha512sums_x86_64=('${dott_checksum}' '${readme_checksum}')"
content += '\n\n'
content += 'package() {\n'
content += ' install -Dm 755 "$pkgname-$pkgver" "{pkgdir}/usr/bin/$_pkgname\n'
content += ' install -Dm 644 "$pkgname-$pkgver-README.md" "{pkgdir}/usr/share/doc/$pkgname/README.md\n'
content += '}'
pkgbuild.write(content)

0 comments on commit 6621bf6

Please sign in to comment.