-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates packages for a variety of OS's in appropriate package format, such as dpkg. Creates a gitflow release of that package, and then bumps crate versions to indicate a release, creating a tag for that release.
- Loading branch information
Showing
23 changed files
with
294 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# CI that: | ||
# | ||
# * checks for a Git Tag that looks like a release ("v1.2.0") | ||
# * creates a Github Release™️ | ||
# * builds binaries/packages with cargo-dist | ||
# * uploads those packages to the Github Release™️ | ||
# | ||
# Note that the Github Release™️ will be created before the packages, | ||
# so there will be a few minutes where the release has no packages | ||
# and then they will slowly trickle in, possibly failing. To make | ||
# this more pleasant we mark the release as a "draft" until all | ||
# artifacts have been successfully uploaded. This allows you to | ||
# choose what to do with partial successes and avoids spamming | ||
# anyone with notifications before the release is actually ready. | ||
name: Release | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
level: | ||
description: 'Release level' | ||
required: true | ||
default: 'minor' | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
jobs: | ||
# Build and packages all the things | ||
build-binaries: | ||
strategy: | ||
matrix: | ||
# For these target platforms | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
arch: x86_64 | ||
ext: deb | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
arch: x86_64 | ||
ext: pkg | ||
- target: aarch64-apple-darwin | ||
os: macos-latest | ||
config-file: fpm/osx.fpm | ||
arch: aarch64 | ||
ext: pkg | ||
#- target: x86_64-pc-windows-msvc | ||
# os: windows-latest | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Rust | ||
run: | | ||
rustup update stable | ||
rustup default stable | ||
- name: Setup target | ||
run: rustup target add ${{ matrix.target }} | ||
- name: Install ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Install fpm | ||
run: | | ||
gem install fpm | ||
- name: Run package script | ||
run: | | ||
./ci-scripts/packages.sh --arch ${{ matrix.arch }} --ext ${{ matrix.ext }} | ||
- name: Archive artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ceramic-one_${{ matrix.target }} | ||
path: ceramic-one.${{ matrix.ext }} | ||
|
||
release: | ||
needs: [build-binaries] | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts | ||
- name: check artifacts | ||
run: | | ||
ls artifacts/**/* | ||
- id: install-cargo-release | ||
uses: taiki-e/install-action@v1 | ||
with: | ||
tool: cargo-release | ||
- id: release | ||
run: | | ||
./ci-scripts/release.sh --level ${{ inputs.level }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/target | ||
*/target | ||
/artifacts | ||
|
||
.DS_Store | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
# Script to generate kubo-server crate from OpenAPI definition. | ||
|
||
set -e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env bash | ||
# Script to package our application for distribution. | ||
VALID_ARGS=$(getopt -o fedia: --long config-file,extension,binary-dir,install-dir,architecture: -- "$@") | ||
if [[ $? -ne 0 ]]; then | ||
exit 1; | ||
fi | ||
|
||
EXT="deb" | ||
PKG_TYPE="dpkg" | ||
CONFIG_FILE="fpm/linux.fpm" | ||
INSTALL_DIR="/usr/local/bin" | ||
TARGET="x86_64-unknown-linux-gnu" | ||
|
||
ARCH="" | ||
case $(uname -m) in | ||
x86_64) ARCH="x86_64" ;; | ||
arm64) ARCH="aarch64" ;; | ||
--) | ||
echo "Unknown architecture $(uname -m)" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
CONFIG_FILE="fpm/osx.fpm" | ||
EXT="pkg" | ||
PKG_TYPE="osxpkg" | ||
INSTALL_DIR="/Applications" | ||
TARGET=$ARCH"-apple-darwin" | ||
fi | ||
|
||
eval set -- "$VALID_ARGS" | ||
while [ : ]; do | ||
case "$1" in | ||
-f | --config-file) | ||
CONFIG_FILE=$2 | ||
shift 2 | ||
;; | ||
-e | --extension) | ||
EXT=$2 | ||
shift 2 | ||
;; | ||
-d | --binary-dir) | ||
BIN_DIR=$2 | ||
shift 2 | ||
;; | ||
-i | --install-dir) | ||
INSTALL_DIR=$2 | ||
shift 2 | ||
;; | ||
-a | --architecture) | ||
ARCH=$2 | ||
shift 2 | ||
;; | ||
--) shift; | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
ARTIFACTS_DIR=artifacts | ||
OUT_FILE=$ARTIFACTS_DIR/ceramic-one.$EXT | ||
PKG_VERSION=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"') | ||
BIN_DIR=target/$TARGET/release | ||
|
||
if [ -f $OUT_FILE ]; then | ||
rm $OUT_FILE | ||
fi | ||
|
||
echo "Building package for "$TARGET | ||
|
||
cargo build --release --target $TARGET | ||
|
||
mkdir $ARTIFACTS_DIR || true | ||
|
||
fpm --fpm-options-file $CONFIG_FILE -C $BIN_DIR -v $PKG_VERSION -p $OUT_FILE ceramic-one=$INSTALL_DIR/ceramic-one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# Build and publish a docker image run running ceramic-one | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
# Check specified release level based on commit messages, then if appropriate, release package | ||
VALID_ARGS=$(getopt -o l: --long level: -- "$@") | ||
if [[ $? -ne 0 ]]; then | ||
exit 1; | ||
fi | ||
|
||
LEVEL=minor | ||
|
||
eval set -- "$VALID_ARGS" | ||
while [ : ]; do | ||
case "$1" in | ||
-l | --level) | ||
LEVEL=echo "$2" | tr '[:upper:]' '[:lower:]' | ||
case "$LEVEL" in | ||
major|minor|patch) ;; | ||
*) | ||
echo "Invalid release level: $LEVEL" | ||
exit 1 | ||
;; | ||
esac | ||
shift 2 | ||
;; | ||
--) shift; | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
cd $(git rev-parse --show-toplevel) | ||
|
||
# Using git cliff determine if there are any feat commits that do not belong to a tag. | ||
git cliff --unreleased --strip all --body "{% for group, commits in commits | group_by(attribute=\"group\") %} | ||
{{ group }} {{ commits | length }} | ||
{% endfor %}" | grep Features | ||
ret=$? | ||
if [[ $ret = 0 ]] && [[ $LEVEL = patch ]]; then | ||
echo "Cannot release patch version when there are unreleased features." | ||
exit 1 | ||
fi | ||
|
||
git config user.email "github@3box.io" | ||
git config user.name "Github Automation" | ||
TAG=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"') | ||
cargo release -vv $LEVEL --exclude ceramic-api-server --exclude ceramic-kubo-rpc-server --no-confirm | ||
|
||
#gh release create v$TAG --title "v"$TAG --latest artifacts/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-t deb | ||
-s dir | ||
--name ceramic-one | ||
--license mit | ||
--architecture all | ||
--description "Ceramic API Server" | ||
--url "https://ceramic.network" | ||
--maintainer "3Box Labs <support@3box.com>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-t osxpkg | ||
-s dir | ||
--name ceramic-one | ||
--license mit | ||
--architecture all | ||
--description "Ceramic API Server" | ||
--url "https://ceramic.network" | ||
--maintainer "3Box Labs <support@3box.com>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.