From 3ab488e6eb4cc3a2ee3abd3d40a7db1eeda1d32a Mon Sep 17 00:00:00 2001 From: Joe Sacher <321623+sacherjj@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:06:27 -0500 Subject: [PATCH] Cleaner deb implementation. Update publish deb for new infra. --- .../workflows/publish-casper-db-utils-deb.yml | 43 ++++++++++++------- Cargo.lock | 2 +- Cargo.toml | 25 +++++++++-- rust-toolchain.toml | 2 + 4 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/publish-casper-db-utils-deb.yml b/.github/workflows/publish-casper-db-utils-deb.yml index 386ec72..4ed540d 100644 --- a/.github/workflows/publish-casper-db-utils-deb.yml +++ b/.github/workflows/publish-casper-db-utils-deb.yml @@ -13,6 +13,10 @@ jobs: include: - os: ubuntu-20.04 code_name: focal + - os: ubuntu-22.04 + code_name: jammy + - os: ubuntu-24.04 + code_name: noble runs-on: ${{ matrix.os }} @@ -23,12 +27,19 @@ jobs: toolchain: stable profile: minimal + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ACCESS_ROLE_REPO }} + role-session-name: GitHub_to_AWS_via_FederatedOIDC + aws-region: ${{ secrets.AWS_ACCESS_REGION_REPO }} + - name: Install deps run: | echo "deb http://repo.aptly.info/ squeeze main" | sudo tee -a /etc/apt/sources.list.d/aptly.list wget -qO - https://www.aptly.info/pubkey.txt | sudo apt-key add - sudo apt-get update - sudo apt-get install -y awscli aptly=1.2.0 + sudo apt-get install -y aptly=1.4.0 aptly config show - name: Import GPG key @@ -52,28 +63,30 @@ jobs: - name: Cargo deb uses: actions-rs/cargo@v1 with: - command: deb + command: deb --no-build --variant ${{ matrix.code_name }} - name: Upload binaries to repo env: - AWS_SECRET_ACCESS_KEY: ${{ secrets.APTLY_SECRET_KEY }} - AWS_ACCESS_KEY_ID: ${{ secrets.APTLY_ACCESS_KEY }} - PLUGIN_REPO_NAME: ${{ secrets.APTLY_REPO }} - PLUGIN_REGION: ${{ secrets.APTLY_REGION }} + PLUGIN_REPO_NAME: ${{ secrets.AWS_BUCKET_REPO }} + PLUGIN_REGION: ${{ secrets.AWS_ACCESS_REGION_REPO }} PLUGIN_GPG_KEY: ${{ secrets.APTLY_GPG_KEY }} PLUGIN_GPG_PASS: ${{ secrets.APTLY_GPG_PASS }} - PLUGIN_ACL: 'public-read' + PLUGIN_ACL: 'private' PLUGIN_PREFIX: 'releases' PLUGIN_DEB_PATH: './target/debian' PLUGIN_OS_CODENAME: ${{ matrix.code_name }} run: ./ci/publish_deb_to_repo.sh - - name: Invalidate cloudfront - uses: chetan/invalidate-cloudfront-action@v1 - env: - DISTRIBUTION: ${{ secrets.APTLY_DIST_ID }} - PATHS: "/*" - AWS_REGION: ${{ secrets.APTLY_REGION }} - AWS_ACCESS_KEY_ID: ${{ secrets.APTLY_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.APTLY_SECRET_KEY }} + - name: Invalidate CloudFront cache + run: | + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_REPO }} --paths "/*" + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/debian/casper-db-utils* + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/Cargo.lock b/Cargo.lock index f0da41a..b9d55f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -300,7 +300,7 @@ dependencies = [ [[package]] name = "casper-db-utils" -version = "0.1.0-dev+casper.node.1.4.15" +version = "0.1.0" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index c8985d0..6afbba8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "casper-db-utils" -version = "0.1.0-dev+casper.node.1.4.15" -authors = ["George Pisaltu "] +version = "0.1.0" +authors = ["George Pisaltu ", "Joe Sacher "] edition = "2021" description = "Utilities for working with databases of the Casper blockchain." documentation = "https://docs.rs/casper-db-utils" readme = "README.md" -homepage = "https://casperlabs.io" +homepage = "https://casper.network" repository = "https://github.com/casper-network/casper-db-utils" license = "Apache-2.0" build = "build.rs" @@ -41,3 +41,22 @@ tempfile = "3" [build-dependencies] cargo-lock = { version = "9.0", default-features = false } + +[package.metadata.deb] +revision = "0" +assets = [["./target/release/casper-db-utils", "/usr/bin/casper-db-utils", "755"]] +extended-description = """ +Package for Casper DB Utils to perform various actions on a Casper-Node database. +""" + +[package.metadata.deb.variants.focal] +name = "casper-db-utils" +revision = "0+focal" + +[package.metadata.deb.variants.jammy] +name = "casper-db-utils" +revision = "0+jammy" + +[package.metadata.deb.variants.noble] +name = "casper-db-utils" +revision = "0+noble" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..dc2d42d --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.80.0" \ No newline at end of file