Skip to content

Commit

Permalink
build: Publish on tag
Browse files Browse the repository at this point in the history
* The tag comes from the github event, not the git tag.

```
if: startsWith(github.event.ref, 'refs/tags/v')
```

* Still manual steps to first set version number
* Included publish-docs in same workflow
  • Loading branch information
patriknw committed Oct 20, 2023
1 parent 9a68715 commit 9ee7d46
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 87 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/publish-docs.yml

This file was deleted.

60 changes: 59 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Publish

on:
workflow_dispatch:
push:
branches:
- main
tags: ["*"]

permissions:
contents: read
Expand Down Expand Up @@ -49,3 +52,58 @@ jobs:
- name: Publish ${{ matrix.PACKAGE }}
if: startsWith(github.event.ref, 'refs/tags/v')
run: cargo publish --registry AKKA_RS -p ${{ matrix.PACKAGE }}

documentation:
if: github.event.repository.fork == false
name: Documentation
# the release environment provides access to secrets required in the release process
# https://github.com/akka/akka-edge-rs/settings/environments
environment: release
runs-on: ubuntu-22.04
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: Create API documentation
run: cargo doc --no-deps

- name: Key setup
env:
GUSTAV_KEY: ${{ secrets.GUSTAV_KEY }}
run: |+
eval "$(ssh-agent -s)"
echo $GUSTAV_KEY | base64 -di > .github/id_ed2551
chmod 600 .github/id_ed2551
ssh-add .github/id_ed2551
- name: Publish API documentation (tag)
if: startsWith(github.event.ref, 'refs/tags/v')
env:
TAG: ${{ github.event.ref }}
run: |+
cd target/doc
rsync -r . akkarepo@gustav.akka.io:www/api/akka-edge-rs/${TAG}/
- name: Publish API documentation (snapshot)
if: ${{ ! startsWith(github.event.ref, 'refs/tags/') }}
run: |+
cd target/doc
rsync -r . akkarepo@gustav.akka.io:www/api/akka-edge-rs/snapshot/
24 changes: 8 additions & 16 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
Releasing
===
# Releasing

1. Update the cargo.toml and change the `workspace.package.version`.
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).
3. Commit the changes.
4. Create a release from https://github.com/lightbend/akka-edge-rs/releases. Tag with the same version as in cargo.toml
using `v` as a prefix e.g. 1.0.0 would be "v1.0.0".
5. [CI workflow](https://github.com/lightbend/akka-edge-rs/actions/workflows/publish.yml) will publish to
http://repo.akka.io/cargo and https://doc.akka.io/api/akka-edge-rs/`<version>`/

```
cargo publish -p akka-persistence-rs
cargo publish -p akka-persistence-rs-commitlog
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
## 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
Expand All @@ -30,4 +22,4 @@ Credentials bound to the `cloudsmith-machine` user should be used:
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 9ee7d46

Please sign in to comment.