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

feat: updated release workflow #225

Closed
wants to merge 3 commits into from
Closed
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
22 changes: 18 additions & 4 deletions .github/workflows/cd-to-infra.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Continuous Deployment to Infra

permissions:
contents: write

on:
push:
branches: [ "main" ]
# Trigger on all release events until we can figure out the optimal selection
release:
types: [created, published, edited, prereleased, released]

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
Expand Down Expand Up @@ -37,7 +40,8 @@ jobs:
run: |
SHA_TAG=$(echo ${{ github.SHA }} | head -c 12)
DEPLOY_TAG=$SHA_TAG
if [[ ${{ contains(github.event.head_commit.message, 'chore: Release') }} == 'true' ]]; then
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ $(echo "$COMMIT_MESSAGE" | grep 'chore: version v') ]]; then
RELEASE_TAG=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"')
# Use the release tag to deploy, if one is available.
DEPLOY_TAG=$RELEASE_TAG
Expand All @@ -60,15 +64,25 @@ jobs:
echo "Workflow triggered by: ${{ github.event_name }}"
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "Release action: ${{ github.event.action }}"
if [[ "${{ github.event.action }}" == "prereleased" ]]; then
# For some reason, GitHub won't trigger the "created" or "prereleased" events when a pre-release is created
# from the "publish-release.yml" workflow. This is despite using a PAT to create the pre-release, which is
# the recommended way to trigger one workflow from another.
#
# This would imply that there was some issue with the repo or workflow configuration but GitHub does trigger
# the "published" workflow. Because of this, we're detecting pre-releases through the "published" event and
# its "prerelease" flag.
#
# Strangely enough, the "edited" and "released" events are triggered when promoting the pre-release to a
# release through the GitHub console (╯°□°)╯︵ ┻━┻
if [[ "${{ github.event.action }}" == "published" && "${{ github.event.release.prerelease }}" == "true" ]]; then
DEPLOY_ENV="tnet"
elif [[ "${{ github.event.action }}" == "released" ]]; then
DEPLOY_ENV="prod"
fi
else
DEPLOY_ENV="qa"
fi
echo "DEPLOY_ENV is $DEPLOY_ENV"
if [[ -n "$DEPLOY_ENV" ]]; then
make DEPLOY_ENV="$DEPLOY_ENV" DEPLOY_TAG=${{ needs.publish.outputs.deploy_tag }} schedule-k8s-deployment
fi
echo "DEPLOY_ENV is $DEPLOY_ENV"
16 changes: 10 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ permissions:

on:
push:
branches: [ "main" ]
branches: [ "main", "feature/cd" ]
paths:
- 'Cargo.toml'

jobs:
# Build and packages all the things
# Build and package all the things
build-binaries:
if: |
contains(github.event.head_commit.message, 'chore: Release')
contains(github.event.head_commit.message, 'chore: version v')
strategy:
matrix:
# For these target platforms
Expand Down Expand Up @@ -82,8 +82,8 @@ jobs:
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN_PAT }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PAT }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -100,4 +100,8 @@ jobs:
run: |
export TAG=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"')
echo "Releasing "$TAG
gh release create "v${TAG}" -n "Release of ${TAG}" -t "v${TAG}" --latest artifacts/**/*.tar.gz
# Generate a GitHub pre-release. This will trigger the "published" event that will deploy to Clay. When the
# pre-release is promoted to a release from the GitHub console, the "released" event will trigger and deploy
# to Prod.
current_branch=$(git rev-parse --abbrev-ref HEAD)
gh release create "v${TAG}" -t "v${TAG}" --target "$current_branch" --generate-notes --prerelease artifacts/**/*.tar.gz
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,63 @@

All notable changes to this project will be documented in this file.

## [0.10.0] - 2024-01-23

### Bug Fixes

- Check limits first before other behaviours (#183)
- Panic with divide by zero duration math (#184)
- Fix JSON log format errors (#185)
- Update comment to pass clippy (#189)
- Run publisher in its own task (#188)
- Trickle publisher keys to swarm (#191)
- Use AIMD for publisher batch size (#195)
- Do not use bootstrap list with kademlia (#199)
- Simplify the publisher (#200)
- Always collect metrics (#202)
- Typo (#203)
- Upgrade to libp2p 0.53 (#205)
- Clippy accessing first element with first (#212)
- Update deploy workflows for k8s (#216)
- Rename workflows (#223)

### Features

- Continously publish provider records (#175)
- Add publisher batch metrics (#187)
- Add config for republish_max_concurrent (#192)
- Add peering support (#194)
- Add tokio metrics (#206)
- Merge migration script with ceramic-one (#190)
- Add metrics to api and recon (#208)
- Schedule_k8s_deploy github action (#213)
- Recon-over-http (#168)
- Remove all usage of gossipsub (#209)
- Stop publishing CIDs to DHT on write (#211)
- On tag publish deploy to envs (#220)
- Add sqlite read/write pool split (#218)
- Add recon store metrics (#221)
- Updated release workflow
- Updated release workflow

### Refactor

- Update bitswap logs to use structured logging (#193)

## [0.9.0] - 2023-11-13

### Bug Fixes

- Rename iroh to ceramic-one in agent (#181)

### Features

- Add control over autonat (#176)

### Miscellaneous Tasks

- Pass manual flag through in deployment job (#180)
- Release version v0.9.0 (#182)

## [0.8.3] - 2023-11-09

Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ xtaskops = "0.3"
zeroize = "1.4"

[workspace.package]
version = "0.9.0"
version = "0.10.0"
edition = "2021"
authors = [
"Danny Browning <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion api-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ceramic-api-server"
version = "0.9.0"
version = "0.10.0"
authors = ["OpenAPI Generator team and contributors"]
description = "This is the Ceramic API for working with streams and events "
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions api-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ To see how to make this your own, look here:

[README]((https://openapi-generator.tech))

- API version: 0.9.0
- Build date: 2023-11-13T20:39:15.118815608Z[Etc/UTC]
- API version: 0.10.0
- Build date: 2024-01-23T20:42:04.805616841Z[Etc/UTC]



Expand Down
2 changes: 1 addition & 1 deletion api-server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ info:
name: MIT
url: https://mit-license.org/
title: Ceramic API
version: 0.9.0
version: 0.10.0
servers:
- url: /ceramic
paths:
Expand Down
2 changes: 1 addition & 1 deletion api-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use swagger::{ApiError, ContextWrapper};
type ServiceError = Box<dyn Error + Send + Sync + 'static>;

pub const BASE_PATH: &str = "/ceramic";
pub const API_VERSION: &str = "0.9.0";
pub const API_VERSION: &str = "0.10.0";

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub enum EventsPostResponse {
Expand Down
2 changes: 1 addition & 1 deletion api/ceramic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0
info:
description: >
This is the Ceramic API for working with streams and events
version: 0.9.0
version: 0.10.0
title: Ceramic API
#license:
# name: Apache 2.0
Expand Down
15 changes: 8 additions & 7 deletions ci-scripts/release_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ cargo update -p ceramic-api-server
# Commit the specified packages
# `cargo release commit` currently fails to build a good commit message.
# Using git commit directly for now
branch="release-v${version}"
git checkout -b "$branch"
msg="chore: release version v${version}"
current_branch=$(git rev-parse --abbrev-ref HEAD)
pr_branch="version-v${version}"
git checkout -b "$pr_branch"
msg="chore: version v${version}"
git commit -am "$msg"
git push --set-upstream origin $branch
git push --set-upstream origin "$pr_branch"

# Create a PR
# Create a PR against the branch this workflow is running on
gh pr create \
--base main \
--head "$branch" \
--base "$current_branch" \
--head "$pr_branch" \
--label release \
--title "$msg" \
--body "$release_notes"
2 changes: 1 addition & 1 deletion kubo-rpc-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ceramic-kubo-rpc-server"
version = "0.9.0"
version = "0.10.0"
authors = ["OpenAPI Generator team and contributors"]
description = "This is the Kubo RPC API for working with IPLD data on IPFS This API only defines a small subset of the official API. "
license = "MIT"
Expand Down
Loading