Skip to content

Commit

Permalink
changes for CI (#24)
Browse files Browse the repository at this point in the history
Co-authored-by: Muhmud Ahmad <[email protected]>
  • Loading branch information
muhmud and Muhmud Ahmad authored Jan 10, 2024
1 parent 60b11d7 commit 4c3c920
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release
on: workflow_dispatch
jobs:
prepare-release:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@v4
name: Fetch entire history (for conventional commits)
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.name GitHub Actions
git config user.email [email protected]
- name: Install Knope
uses: knope-dev/[email protected]
with:
version: 0.11.0
- run: knope prepare-release --verbose
name: Update versioned files and changelog
- name: Store commit
id: commit
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

build-artifacts:
needs: prepare-release
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-release.outputs.sha }}
- uses: Homebrew/actions/setup-homebrew@master
- uses: ningenMe/[email protected]
- name: Install Make
run: brew install make
- name: Build Setup
run: make mac-setup
- name: Build Artifacts
run: make all
- name: Upload Artifact
uses: actions/[email protected]
with:
name: dotlottie-player.android.tar.gz
path: release/android/dotlottie-player.android.tar.gz
if-no-files-found: error
- name: Upload Artifact
uses: actions/[email protected]
with:
name: dotlottie-player.darwin.tar.gz
path: release/darwin/dotlottie-player.darwin.tar.gz
if-no-files-found: error
- name: Upload Artifact
uses: actions/[email protected]
with:
name: dotlottie-player.wasm.tar.gz
path: release/wasm/dotlottie-player.wasm.tar.gz
if-no-files-found: error

release:
needs: [build-artifacts, prepare-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-release.outputs.sha }}
- uses: actions/[email protected]
with:
path: release
merge-multiple: true
- name: Install Knope
uses: knope-dev/[email protected]
with:
version: 0.11.0
- run: knope release --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ STRIP := $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(ANDROID_BUILD_PLATFORM)/

# Apple
APPLE := apple
DARWIN := darwin
APPLE_BUILD := $(BUILD)/$(APPLE)

APPLE_IOS := ios
Expand Down Expand Up @@ -374,6 +375,9 @@ define ANDROID_RELEASE
cp $(RUNTIME_FFI_TARGET_LIB) $(DOTLOTTIE_PLAYER_LIB_DIR)/$(DOTLOTTIE_PLAYER_LIB)
cp $(RUNTIME_FFI)/$(RUNTIME_FFI_ANDROID_ASSETS)/$(ANDROID)/* $(DOTLOTTIE_PLAYER_ANDROID_RELEASE_DIR)
echo "dlplayer-version=$(CRATE_VERSION)-$(COMMIT_HASH)" > $(DOTLOTTIE_PLAYER_ANDROID_RELEASE_DIR)/$(DOTLOTTIE_PLAYER_GRADLE_PROPERTIES)
cd $(RELEASE)/$(ANDROID) && \
rm -f $(DOTLOTTIE_PLAYER).$(ANDROID).tar.gz && \
tar zcf $(DOTLOTTIE_PLAYER).$(ANDROID).tar.gz *
endef

define LIPO_CREATE
Expand Down Expand Up @@ -414,6 +418,9 @@ define APPLE_RELEASE
$$(find $(RUNTIME_FFI)/$(APPLE_BUILD) -type d -depth 2 | sed 's/^/-framework /' | tr '\n' ' ') \
-output $(RELEASE)/$(APPLE)/$(DOTLOTTIE_PLAYER_XCFRAMEWORK)
cp $(RUNTIME_FFI)/$(RUNTIME_FFI_UNIFFI_BINDINGS)/$(SWIFT)/$(DOTLOTTIE_PLAYER_SWIFT) $(RELEASE)/$(APPLE)/.
cd $(RELEASE)/$(APPLE) && \
rm -f $(DOTLOTTIE_PLAYER).$(DARWIN).tar.gz && \
tar zcf $(DOTLOTTIE_PLAYER).$(DARWIN).tar.gz *
endef

define WASM_RELEASE
Expand All @@ -422,6 +429,9 @@ define WASM_RELEASE
cp $(RUNTIME_FFI)/$(WASM_BUILD)/$(BUILD)/$(WASM_MODULE).wasm \
$(RUNTIME_FFI)/$(WASM_BUILD)/$(BUILD)/$(WASM_MODULE).js \
$(RELEASE)/$(WASM)
cd $(RELEASE)/$(WASM) && \
rm -f $(DOTLOTTIE_PLAYER).$(WASM).tar.gz && \
tar zcf $(DOTLOTTIE_PLAYER).$(WASM).tar.gz *
endef

# $1: rust target triple, e.g. aarch64-linux-android
Expand Down
43 changes: 43 additions & 0 deletions knope.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[github]
owner = 'LottieFiles'
repo = 'dotlottie-rs'

[package]
versioned_files = ["dotlottie-ffi/Cargo.toml"]

[[package.assets]]
path = "release/dotlottie-player.darwin.tar.gz"
name = "dotlottie-player.darwin.tar.gz"

[[package.assets]]
path = "release/dotlottie-player.android.tar.gz"
name = "dotlottie-player.android.tar.gz"

[[package.assets]]
path = "release/dotlottie-player.wasm.tar.gz"
name = "dotlottie-player.wasm.tar.gz"

[[workflows]]
name = "prepare-release"

[[workflows.steps]]
type = "PrepareRelease"

[[workflows.steps]]
type = "Command"
command = "git commit -m \"chore: prepare release $version\" && git push"

[workflows.steps.variables]
"$version" = "Version"

[[workflows]]
name = "release"

[[workflows.steps]]
type = "Release"

[[workflows]]
name = "document-change"

[[workflows.steps]]
type = "CreateChangeFile"

0 comments on commit 4c3c920

Please sign in to comment.