From fd783413db16cdc176f3dc435a87b2b9a8fb8469 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:06:30 -0500 Subject: [PATCH] chore: publish aur releases --- .github/workflows/publish-cli.yml | 40 ++++++++-- .github/workflows/release-plz.yml | 3 + .idea/vcs.xml | 1 + .mise/tasks/bump-aur | 127 ++++++++++++++++++++++++++++++ .mise.toml => mise.toml | 15 ++-- tasks | 1 + 6 files changed, 175 insertions(+), 12 deletions(-) create mode 100755 .mise/tasks/bump-aur rename .mise.toml => mise.toml (71%) create mode 120000 tasks diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index ad1e1618..a2b5a8ea 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -5,7 +5,7 @@ permissions: on: push: - tags: ["v*"] + tags: [ "v*" ] concurrency: group: publish-cli-${{ github.ref_name }} @@ -13,14 +13,16 @@ concurrency: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 + NPM_CONFIG_FUND: false + DRY_RUN: ${{ !startsWith(github.ref, 'refs/tags/v') }} jobs: - publish-cli: + build: strategy: matrix: include: - target: universal-apple-darwin - os: macos-14 + os: macos-latest - target: x86_64-unknown-linux-gnu os: ubuntu-latest - target: x86_64-unknown-linux-musl @@ -33,20 +35,31 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + - uses: jdx/mise-action@v2 + with: + experimental: true + - if: matrix.os == 'macos' + uses: apple-actions/import-codesign-certs@v3 + with: + p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 }} + p12-password: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS }} - uses: taiki-e/upload-rust-binary-action@v1 with: bin: usage token: ${{ secrets.GITHUB_TOKEN }} target: ${{ matrix.target }} manifest-path: cli/Cargo.toml + dry_run: ${{ startsWith(github.ref, 'refs/tags/v') }} + codesign: true + codesign_prefix: dev.jdx. env: CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 CARGO_PROFILE_RELEASE_LTO: true bump-homebrew-formula: - runs-on: macos-14 + runs-on: macos-latest timeout-minutes: 10 - needs: [publish-cli] continue-on-error: true + if: ${{ startsWith(github.ref, 'refs/tags/v') }} steps: - name: Bump Homebrew formula uses: dawidd6/action-homebrew-bump-formula@v3 @@ -59,3 +72,20 @@ jobs: token: ${{ secrets.GH_BOT_TOKEN }} formula: usage tap: jdx/homebrew-tap + bump-aur: + runs-on: ubuntu-latest + needs: [ build ] + steps: + - uses: jdx/mise-action@v2 + with: + experimental: true + - uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.AUR_SSH_KEY }} + known_hosts: ${{ secrets.AUR_KNOWN_HOSTS }} + - uses: actions/download-artifact@v4 + with: + pattern: usage-*.tar.gz + merge-multiple: true + - run: mise run bump-aur usage + - run: mise run bump-aur usage-bin diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index 239e2ffd..254a2c07 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -10,6 +10,9 @@ on: - main - release-plz +env: + NPM_CONFIG_FUND: false + concurrency: group: release-plz diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1ddf..974504d5 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.mise/tasks/bump-aur b/.mise/tasks/bump-aur new file mode 100755 index 00000000..dcb977d6 --- /dev/null +++ b/.mise/tasks/bump-aur @@ -0,0 +1,127 @@ +#!/usr/bin/env bash +set -euxo pipefail +#USAGE arg "pkgname" +env + +USAGE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "usage-cli") | .version') + +if [ ! -d aur ]; then + git clone ssh://aur@aur.archlinux.org/usage.git aur +fi +git -C aur pull + +if [ "$usage_pkgname" == "usage" ]; then + SOURCE_SHA512=$(curl -fsSL "https://github.com/jdx/usage/archive/$USAGE_VERSION.tar.gz" | sha512sum | awk '{print $1}') + SHA512="$SOURCE_SHA512" + cat >aur/PKGBUILD < + +pkgname=usage +pkgver=${USAGE_VERSION#v*} +pkgrel=1 +pkgdesc='A specification for CLIs' +arch=('x86_64') +url='https://github.com/jdx/usage' +license=('MIT') +makedepends=('cargo') +provides=('usage') +source=("\$pkgname-\$pkgver.tar.gz::https://github.com/jdx/\$pkgname/archive/v\$pkgver.tar.gz") +sha512sums=('$SOURCE_SHA512') + +prepare() { + cd "\$srcdir/\$pkgname-\$pkgver" + cargo fetch --locked --target "\$CARCH-unknown-linux-gnu" +} + +build() { + cd "\$srcdir/\$pkgname-\$pkgver" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release --bin usage +} + +package() { + cd "\$srcdir/\$pkgname-\$pkgver" + install -Dm755 target/release/usage "\$pkgdir/usr/bin/usage" +} + +check() { + cd "\$srcdir/\$pkgname-\$pkgver" + ./target/release/usage --version +} +EOF + cat >aur/.SRCINFO <aur/PKGBUILD < + +pkgname=usage-bin +pkgver=${USAGE_VERSION#v*} +pkgrel=1 +pkgdesc='A specification for CLIs' +arch=('x86_64') +url='https://github.com/jdx/usage' +license=('MIT') +makedepends=('cargo') +provides=('usage') +source=("usage-\$pkgver.tar.gz::https://github.com/jdx/usage/releases/download/v\$pkgver/usage-x86_64-unknown-linux-gnu.tar.gz") +sha512sums=('$SHA512') + +build() { + cd "\$srcdir/" +} + +package() { + cd "\$srcdir/" + install -Dm755 usage "\$pkgdir/usr/bin/usage" +} + +check() { + "\$srcdir/usage" --version +} +EOF + cat >aur/.SRCINFO < ~/src/mise/completions/mise.bash', - 'usage g completion zsh mise --usage-cmd "@mise usage" > ~/src/mise/completions/_mise', - 'usage g completion fish mise --usage-cmd "@mise usage" > ~/src/mise/completions/mise.fish', + 'usage g completion bash mise --usage-cmd "@mise usage" > ~/src/mise/completions/mise.bash', + 'usage g completion zsh mise --usage-cmd "@mise usage" > ~/src/mise/completions/_mise', + 'usage g completion fish mise --usage-cmd "@mise usage" > ~/src/mise/completions/mise.fish', ] [tasks."render:example-md"] depends = ['build'] run = [ - "usage g md examples/docs/MISE_INLINE.md", - "usage g md examples/docs/MISE_MULTI.md", + "usage g md examples/docs/MISE_INLINE.md", + "usage g md examples/docs/MISE_MULTI.md", ] [tasks.release] diff --git a/tasks b/tasks new file mode 120000 index 00000000..1d02a36b --- /dev/null +++ b/tasks @@ -0,0 +1 @@ +.mise/tasks \ No newline at end of file