Skip to content

Commit

Permalink
add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kmd-fl committed Mar 18, 2024
1 parent 15c531e commit 28e6a57
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 18 deletions.
12 changes: 12 additions & 0 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"bootstrap-sha": "a5bed5fc40f29c1ea8493a6d259fb590d5b7e88e",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"package-name": "test-ci",
"compontent": "test-ci"
}
}
}
3 changes: 3 additions & 0 deletions .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.2"
}
103 changes: 103 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Release

on:
push:
branches:
- main

env:
FORCE_COLOR: true

jobs:
release-please:
runs-on: ubuntu-latest

outputs:
version: ${{ steps.release.outputs['version'] }}
pr: ${{ steps.release.outputs['pr'] }}
tag-name: ${{ steps.release.outputs['tag_name'] }}
release_created: ${{ steps.release.outputs['release_created'] }}

steps:
- name: Release with release-please
id: release
uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json

- name: Show output from release-please
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq

bump-version:
if: ${{ needs.release-please.outputs.pr != null }}
runs-on: ubuntu-latest
needs:
- release-please

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
token: ${{ secrets.RELEASE_TOKEN }}

- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1

- name: Install cargo-edit
uses: baptiste0928/[email protected]
with:
crate: cargo-edit

- name: Get nox version
id: version
run: |
version="$(jq -r '.[]' .github/release-please/manifest.json)"
echo "version=${version}" >> $GITHUB_OUTPUT
# Update ALL packages version if some is changed
- name: Set version
run: cargo set-version ${{ steps.version.outputs.version }}

- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Bump version to ${{ steps.version.outputs.version }}"
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}

upload-archive:
if: ${{ needs.release-please.outputs.release_created }}

runs-on: ubuntu-latest
needs:
- release-please

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
# TODO: fluence module pack works only on main now, need to change later
version: unstable

- name: Build archive
run: fluence module pack ./effector --binding-crate=./imports/ --no-input -d .

- name: Upload archive
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.tag-name }}
files: |
./ls_effector.tar.gz
14 changes: 6 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
# TODO: fluence module build now only in main, need to change later
version: main

- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1

- name: Setup cargo-nextest
uses: taiki-e/install-action@nextest

- name: Setup marine
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine

- name: Setup IPFS CLI
uses: nahsi/setup-ipfs@v1

- name: Build
run: ./build.sh

Expand Down
5 changes: 1 addition & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ set -o errexit -o nounset -o pipefail
cd "$(dirname "$0")"

# This script builds all subprojects and puts all created Wasm modules in one dir
cd effector
marine build --release
cd ..
fluence module build ./effector --no-input

cd cid
cargo build --release
7 changes: 4 additions & 3 deletions effector/module.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# yaml-language-server: $schema=../.fluence/schemas/module.json
version: 0
version: 1

type: rust

name: ls_effector

mountedBinaries:
ls: /usr/bin/ls
effects:
binaries:
ls: /usr/bin/ls
4 changes: 1 addition & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ set -o errexit -o nounset -o pipefail
# set current working directory to script directory to run script from everywhere
cd "$(dirname "$0")"

# build the effector module
cd effector
marine build --release
fluence module build ./effector --no-input

WASM_LOG=debug cargo nextest run --release --no-fail-fast --nocapture

0 comments on commit 28e6a57

Please sign in to comment.