From fab1f6f7f5d9b050264dda8a7775dbd24f5596f9 Mon Sep 17 00:00:00 2001 From: Marcin Anforowicz Date: Fri, 7 Jun 2024 10:37:51 -0700 Subject: [PATCH] further testing ci --- .github/workflows/release.yml | 43 ++++++++++++++++++++++- .github/workflows/{ci.yml => test.yml} | 4 +++ Cargo.toml | 10 +++--- gday/Cargo.toml | 1 + gday_contact_exchange_protocol/Cargo.toml | 1 + gday_encryption/Cargo.toml | 1 + gday_file_transfer/Cargo.toml | 1 + gday_hole_punch/Cargo.toml | 1 + gday_server/Cargo.toml | 1 + 9 files changed, 58 insertions(+), 5 deletions(-) rename .github/workflows/{ci.yml => test.yml} (93%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c816275..631e240 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -235,15 +235,56 @@ jobs: name: artifacts-dist-manifest path: dist-manifest.json + publish-homebrew-formula: + needs: + - plan + - host + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PLAN: ${{ needs.plan.outputs.val }} + GITHUB_USER: "axo bot" + GITHUB_EMAIL: "admin+bot@axo.dev" + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + steps: + - uses: actions/checkout@v4 + with: + repository: "manforowicz/homebrew-tap" + token: ${{ secrets.HOMEBREW_TAP_TOKEN }} + # So we have access to the formula + - name: Fetch homebrew formulae + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: Formula/ + merge-multiple: true + # This is extra complex because you can make your Formula name not match your app name + # so we need to find releases with a *.rb file, and publish with that filename. + - name: Commit formula files + run: | + git config --global user.name "${GITHUB_USER}" + git config --global user.email "${GITHUB_EMAIL}" + + for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do + filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output) + name=$(echo "$filename" | sed "s/\.rb$//") + version=$(echo "$release" | jq .app_version --raw-output) + + git add "Formula/${filename}" + git commit -m "${name} ${version}" + done + git push + # Create a GitHub Release while uploading all files to it announce: needs: - plan - host + - publish-homebrew-formula # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} runs-on: "ubuntu-20.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 93% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index fca5254..04476ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,11 @@ name: Cargo Build & Test on: push: + branches: + - main pull_request: + branches: + - main env: CARGO_TERM_COLOR: always diff --git a/Cargo.toml b/Cargo.toml index 4d8a0d0..ffcb111 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,13 +24,15 @@ cargo-dist-version = "0.15.1" # CI backends to support ci = "github" # The installers to generate for each app -installers = [] +installers = ["homebrew"] +# A GitHub repo to push Homebrew formulas to +tap = "manforowicz/homebrew-tap" # Target platforms to build apps for (Rust target-triple syntax) targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] # Publish jobs to run in CI -pr-run-mode = "upload" -# Whether to install an updater program -install-updater = false +publish-jobs = ["homebrew"] +# Publish jobs to run in CI +pr-run-mode = "plan" # The profile that 'cargo dist' will build with [profile.dist] diff --git a/gday/Cargo.toml b/gday/Cargo.toml index 0147d7f..94b07b6 100644 --- a/gday/Cargo.toml +++ b/gday/Cargo.toml @@ -2,6 +2,7 @@ name = "gday" version = "0.1.1" description = "Command line tool to send files easily, securely, and directly, without a relay or port forwarding." +homepage = "https://github.com/manforowicz/gday/gday/" # Inherit these keys from workspace toml authors.workspace = true diff --git a/gday_contact_exchange_protocol/Cargo.toml b/gday_contact_exchange_protocol/Cargo.toml index 9b4af4a..b5db92c 100644 --- a/gday_contact_exchange_protocol/Cargo.toml +++ b/gday_contact_exchange_protocol/Cargo.toml @@ -2,6 +2,7 @@ name = "gday_contact_exchange_protocol" version = "0.1.1" description = "Protocol that peers can use to exchange their public and private socket addresses via a server." +homepage = "https://github.com/manforowicz/gday/gday_contact_exchange_protocol/" # Inherit these keys from workspace toml authors.workspace = true diff --git a/gday_encryption/Cargo.toml b/gday_encryption/Cargo.toml index 0b5e50d..c4d61e8 100644 --- a/gday_encryption/Cargo.toml +++ b/gday_encryption/Cargo.toml @@ -2,6 +2,7 @@ name = "gday_encryption" version = "0.1.1" description = "A simple ChaCha20Poly1305 encryption wrapper around an IO stream." +homepage = "https://github.com/manforowicz/gday/gday_encryption/" # Inherit these keys from workspace toml authors.workspace = true diff --git a/gday_file_transfer/Cargo.toml b/gday_file_transfer/Cargo.toml index 658b365..9c2b779 100644 --- a/gday_file_transfer/Cargo.toml +++ b/gday_file_transfer/Cargo.toml @@ -2,6 +2,7 @@ name = "gday_file_transfer" version = "0.1.1" description = "A minimal protocol to securely transfer files over an IO stream. Used by gday." +homepage = "https://github.com/manforowicz/gday/gday_file_transfer/" # Inherit these keys from workspace toml authors.workspace = true diff --git a/gday_hole_punch/Cargo.toml b/gday_hole_punch/Cargo.toml index 8525bc3..2033ba5 100644 --- a/gday_hole_punch/Cargo.toml +++ b/gday_hole_punch/Cargo.toml @@ -2,6 +2,7 @@ name = "gday_hole_punch" version = "0.1.1" description = "Establish an authenticated peer-to-peer internet connection using TCP hole-punching." +homepage = "https://github.com/manforowicz/gday/gday_hole_punch/" # Inherit these keys from workspace toml authors.workspace = true diff --git a/gday_server/Cargo.toml b/gday_server/Cargo.toml index c14bb55..ab98b06 100644 --- a/gday_server/Cargo.toml +++ b/gday_server/Cargo.toml @@ -2,6 +2,7 @@ name = "gday_server" version = "0.1.1" description = "A server that lets 2 peers exchange their private and public addresses via the gday contact exchange protocol." +homepage = "https://github.com/manforowicz/gday/gday_server/" # Inherit these keys from workspace toml authors.workspace = true