Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to Cloudsmith through Github Actions #60

Merged
merged 5 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[registries.lightbend-akka-rs]
index = "sparse+https://repo.akka.io/cargo/"
File renamed without changes.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish
sebastian-alfers marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
sebastian-alfers marked this conversation as resolved.
Show resolved Hide resolved
if: github.event.repository.fork == false
name: Publish
runs-on: ubuntu-22.04
env:
CARGO_REGISTRIES_AKKA_RS_INDEX: https://dl.cloudsmith.io/${{ secrets.CLOUDSMITH_AKKA_RS_ENTITLEMENT_TOKEN }}/lightbend/akka-rs/cargo/index.git
CARGO_REGISTRIES_AKKA_RS_TOKEN: ${{ secrets.CLOUDSMITH_LIGHTBEND_MACHINE_API_KEY }}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One check we could add is to only publish when there is a tag, fail otherwise. Later we want to automate so that this is run automatically when tagging, but for now we will trigger it manually. Good to have that check so that we are not releasing untagged stuff. The tag can be retrieved as in https://github.com/lightbend/akka-edge-rs/blob/main/.github/workflows/release.yml#L59

Copy link
Contributor Author

@sebastian-alfers sebastian-alfers Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added the if check, do you think that is sufficient for now?

strategy:
fail-fast: false
matrix:
PACKAGE: ["akka-persistence-rs", "akka-persistence-rs-commitlog", "akka-projection-rs", "akka-projection-rs-commitlog", "akka-projection-rs-grpc", "akka-projection-rs-storage"]

steps:
- name: Checkout
# https://github.com/actions/checkout/releases
# v4.1.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608

- name: Update Rust
run: |
rustup update

- name: Install protoc
# https://github.com/taiki-e/install-action/releases
# v2.20.3
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: protoc@${{ env.PROTOC_VERSION }}

- name: Cache Rust
# https://github.com/Swatinem/rust-cache/releases
# v2.7.0
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43

- name: Publish ${{ matrix.PACKAGE }}
if: startsWith(github.event.ref, 'refs/tags/v')
run: cargo publish --registry AKKA_RS -p ${{ matrix.PACKAGE }}
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ yew = { version = "0.20" }

# THE VERSIONS HERE SHOULD BE THE SAME AS PER `workspace.package.version`.

akka-persistence-rs = { path = "akka-persistence-rs", version = "0.1.0" }
akka-persistence-rs-commitlog = { path = "akka-persistence-rs-commitlog", version = "0.1.0" }
akka-projection-rs = { path = "akka-projection-rs", version = "0.1.0" }
akka-persistence-rs = { path = "akka-persistence-rs", version = "0.1.0", registry = "lightbend-akka-rs" }
akka-persistence-rs-commitlog = { path = "akka-persistence-rs-commitlog", version = "0.1.0", registry = "lightbend-akka-rs" }
akka-projection-rs = { path = "akka-projection-rs", version = "0.1.0", registry = "lightbend-akka-rs" }

[profile.bench-debug]
inherits = "release"
Expand Down
17 changes: 17 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Releasing
2. Change the `dependency.akka-*` versions to be the same version number as per step 1.
3. Commit the changes and tag with the version using `v` as a prefix e.g. 1.0.0 would be "v1.0.0".
4. Perform the commands below, and in the same order...
5. To publish from CI, tag the release as per step 1 and [run the job manually](https://github.com/lightbend/akka-edge-rs/actions/workflows/publish.yml).

```
cargo publish -p akka-persistence-rs
Expand All @@ -13,4 +14,20 @@ cargo publish -p akka-projection-rs
cargo publish -p akka-projection-rs-commitlog
cargo publish -p akka-projection-rs-grpc
cargo publish -p akka-projection-rs-storage
```

### Publish to Cloudsmith
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this will become public source, but I guess it's fine anyway to include these details about Cloudsmith

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw we do mention Cloudsmith in akka/akka as well, so I thought its ok.

Ensure the following env vars are available:
```
export CARGO_REGISTRIES_AKKA_RS_INDEX=https://dl.cloudsmith.io/{entitlement-token}/lightbend/akka-rs/cargo/index.git
export CARGO_REGISTRIES_AKKA_RS_TOKEN={api-key}
```

Credentials bound to the `cloudsmith-machine` user should be used:
- `{entitlement-token` can be found [here](https://cloudsmith.io/~lightbend/repos/akka-rs/entitlements/)
- `{api-key}` can be found [here](https://cloudsmith.io/user/settings/api/)

Also make sure to specify the registry `--registry` accordingly, for example:
```
cargo publish -p akka-persistence-rs-commitlog --registry AKKA_RS
```