From 28e6a5746a70a346e0eaf8055bf31aa6701d5241 Mon Sep 17 00:00:00 2001 From: Maria Kuklina Date: Mon, 18 Mar 2024 12:35:43 +0100 Subject: [PATCH] add release workflow --- .github/release-please/config.json | 12 ++++ .github/release-please/manifest.json | 3 + .github/workflows/release.yml | 103 +++++++++++++++++++++++++++ .github/workflows/tests.yml | 14 ++-- build.sh | 5 +- effector/module.yaml | 7 +- test.sh | 4 +- 7 files changed, 130 insertions(+), 18 deletions(-) create mode 100644 .github/release-please/config.json create mode 100644 .github/release-please/manifest.json create mode 100644 .github/workflows/release.yml diff --git a/.github/release-please/config.json b/.github/release-please/config.json new file mode 100644 index 0000000..64c4ae4 --- /dev/null +++ b/.github/release-please/config.json @@ -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" + } + } +} diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json new file mode 100644 index 0000000..001eb2c --- /dev/null +++ b/.github/release-please/manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.2" +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eeb0ac7 --- /dev/null +++ b/.github/workflows/release.yml @@ -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/cargo-install@v3.0.0 + 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46d0517..104f43d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/build.sh b/build.sh index 77cf272..723ecf3 100755 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/effector/module.yaml b/effector/module.yaml index 7cd22a4..3aaf09f 100644 --- a/effector/module.yaml +++ b/effector/module.yaml @@ -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 diff --git a/test.sh b/test.sh index b23bfce..ccf1196 100755 --- a/test.sh +++ b/test.sh @@ -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