Skip to content

Commit

Permalink
ci: move release workflow to nix
Browse files Browse the repository at this point in the history
  • Loading branch information
metaclips committed Sep 19, 2023
1 parent 4819e08 commit 325851c
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 25 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/create-release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
# runs every command in bash (for every job in the workflow)
defaults:
run:
shell: bash
shell: nix develop ./tools/nix#tooling --command bash {0}

jobs:
bump_crates:
Expand All @@ -45,19 +45,16 @@ jobs:
pull-requests: write

name: Bump Crates And Create PR
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment: release
container:
# Note: Do not update this image has it has installed all binaries
# to bump crates and generate changelogs which we don't want installed
# in our CI packages.
image: ghcr.io/build-trust/ockam-builder@sha256:b7790a79e5fd4265d8333bb882010e5d4326778f270bd49693fa35763865df82
steps:
- name: Checkout Ockam
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0

- uses: ./.github/actions/nix_installer

- name: Checkout To New Release Branch
id: commit
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ permissions:

defaults:
run:
shell: bash
shell: nix develop ./tools/nix#tooling --command bash {0}

jobs:
publish_crates:
runs-on: ubuntu-20.04
container:
# Note: Do not update this image has it has installed all binaries
# to bump crates and generate changelogs which we don't want installed
# in our CI packages.
image: ghcr.io/build-trust/ockam-builder@sha256:a04b6a0aa01a93ba9a5c67392872893b261772dedfcd58f72a1addacf7535c09
runs-on: ubuntu-22.04
environment: release
name: "Publish Crates To Crates IO"
steps:
Expand All @@ -44,6 +39,8 @@ jobs:
with:
fetch-depth: 0

- uses: ./.github/actions/nix_installer

- name: Publish Ockam Crates
env:
GIT_TAG: '${{ github.event.inputs.git_tag }}'
Expand Down
3 changes: 2 additions & 1 deletion tools/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# 24.1.7 stipulated by Dockerfile does not build successfully with current nixpkgs input
ockam.elixir.erlangVersion = "24.3.4.10";
ockam.elixir.version = "1.13.0";
ockam.rust.suggestedCargoPlugins = true;
ockam.rust.suggestedCargoPlugins = false;
ockam.rust.rustAnalyzer = false;
};
}
1 change: 0 additions & 1 deletion tools/nix/parts/rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ in {
devShells = let
compilerTools = with pkgs; [
clang
cmake
lld
];

Expand Down
27 changes: 27 additions & 0 deletions tools/nix/parts/tooling.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,44 @@ _: {
devShells.tooling = pkgs.mkShell {
packages = with pkgs; [
config.packages.bats
config.packages.tomlq
commitlint
curl
git
graphviz
jq
which
git-cliff
cargo-release
cargo-readme
# For cargo search query
cargo
cmake
gnupg
];

BATS_LIB = "${config.packages.bats}/share/bats";
};

packages = {
tomlq = let
pname = "tomlq";
version = "0.1.0";
in
pkgs.rustPlatform.buildRustPackage {
inherit pname version;
src = pkgs.fetchFromGitHub {
owner = "jamesmunns";
repo = "tomlq";
rev = "66b1ee60d559dd2881fc8a4e92918fb7a65bb561";
hash = "sha256-xrdpcVywhxueNnu1vTr5o/79VyHA6BEBIAXh7Y9J/vo=";
};

cargoDepsName = pname;
cargoHash = "sha256-F11PsY11KOFjCnd52PjlQ3DzTbl38rzKaJfi6Y4eurM=";
};
};

# Responsible only for formatting this flake itself
formatter = pkgs.alejandra;

Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/release/crate-bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ while [[ "${updated_crates[*]}" != "${recently_updated_crates[*]}" ]]; do
bumped_crates[$crate]=true

echo "Bumping $crate crate"
echo y | cargo release "$version" --config tools/scripts/release/release.toml --no-push --no-publish --no-tag --no-dev-version --package "$name" --execute
cargo release "$version" --config tools/scripts/release/release.toml --no-confirm --no-sign --no-push --no-publish --no-tag --package "$name" --execute -v
done

recently_updated_crates="${updated_crates[@]}"
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/release/crate-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ if [[ $OCKAM_PUBLISH_RECENT_FAILURE == true ]]; then
done
fi

echo y | cargo release release --config tools/scripts/release/release.toml --no-tag --no-verify --no-dev-version $exclude_string --token "$OCKAM_PUBLISH_TOKEN" --execute
cargo release release --no-confirm --config tools/scripts/release/release.toml --no-tag --no-verify $exclude_string --token "$OCKAM_PUBLISH_TOKEN" --execute
9 changes: 2 additions & 7 deletions tools/scripts/release/release.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
dev-version = true
dev-version-ext = "dev"
post-release-commit-message = "chore(rust): release {{crate_name}} dev version {{version}}"
push = false
tag = false
verify = true
consolidate-pushes = true
sign-commit = true
pre-release-commit-message = "chore(rust): crate release {{crate_name}} version {{version}}"
sign-commit = false
sign-tag = false
pre-release-replacements = [
{ file = "CHANGELOG.md", min = 0, search = "## unreleased", replace = "## {{version}} - {{date}}" },
]

0 comments on commit 325851c

Please sign in to comment.