Skip to content

Commit

Permalink
Publish to Cloudsmith through Github Actions (#60)
Browse files Browse the repository at this point in the history
* publish github actions
* start publish only if necessarey
* document how to tag
  • Loading branch information
sebastian-alfers authored Oct 20, 2023
1 parent 830e451 commit a6752ce
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
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

on:
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
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 }}

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
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
```

0 comments on commit a6752ce

Please sign in to comment.