diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16a53c1..07f7a9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,3 +136,31 @@ jobs: with: name: build-macos path: ./artifacts + publish: + name: Publish release + runs-on: ubuntu-latest + needs: [build-test-linux, build-macos] + permissions: + contents: write + steps: + - uses: actions/checkout@v4.1.7 + - uses: actions/download-artifact@v4 + with: + name: build-linux + - uses: actions/download-artifact@v4 + with: + name: build-mac + - name: Pack artifacts + run: | + tar -czvf ./substrate-contracts-node-linux.tar.gz ./substrate-contracts-node-linux + tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./substrate-contracts-node-mac + ls -la + - name: Publish release + uses: ghalactic/github-release-from-tag@v5 + if: github.ref_type == 'tag' + with: + prerelease: false + draft: true + assets: | + - path: substrate-contracts-node-linux.tar.gz + - path: substrate-contracts-node-mac-universal.tar.gz diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 2bfc1ef..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,165 +0,0 @@ -# .gitlab-ci.yml -# -# substrate-contracts-node -# -# pipelines can be triggered manually in the web - -default: - interruptible: true - retry: - max: 2 - when: - - runner_system_failure - - unknown_failure - - api_failure - -stages: - - fmt - - build-linux - - build-mac - - publish - -variables: - GIT_STRATEGY: fetch - GIT_DEPTH: 100 - CARGO_INCREMENTAL: 0 - -.collect-artifacts: &collect-artifacts - artifacts: - name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" - when: on_success - expire_in: 7 days - paths: - - artifacts/ - -.docker-env: &docker-env - image: paritytech/ci-unified:latest - before_script: - - cargo -vV - - rustc -vV - - rustup show - - bash --version - tags: - - linux-docker-vm-c2 - -.kubernetes-env: &kubernetes-env - tags: - - kubernetes-parity-build - -.build-refs: &build-refs - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME == "main" - - if: $CI_COMMIT_REF_NAME == "tags" - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - -.publish-refs: &publish-refs - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - -### stage: fmt - -fmt: - stage: fmt - <<: *docker-env - script: - - cargo +nightly fmt --verbose --all -- --check - -### stage: build-linux - -build-linux: - stage: build-linux - <<: *docker-env - <<: *collect-artifacts - <<: *build-refs - script: - - time cargo build --release - - time cargo test --release --all - - mkdir -p ./artifacts/substrate-contracts-node-linux/ - - cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node - -### stage: build-mac - -build-mac: - stage: build-mac - <<: *docker-env - <<: *collect-artifacts - <<: *build-refs - before_script: - - unset CARGO_TARGET_DIR - script: - - rustup component add rust-src rustfmt - - rustup target add wasm32-unknown-unknown aarch64-apple-darwin - - time cargo build --release --target aarch64-apple-darwin - - rustup target add x86_64-apple-darwin - - time cargo build --release --target x86_64-apple-darwin - - mkdir -p ./artifacts/substrate-contracts-node-mac/ - - 'lipo - ./target/x86_64-apple-darwin/release/substrate-contracts-node - ./target/aarch64-apple-darwin/release/substrate-contracts-node - -create - -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node' - tags: - - osx - -publish: - stage: publish - <<: *kubernetes-env - image: paritytech/tools:latest - <<: *publish-refs - needs: - - job: build-linux - artifacts: true - - job: build-mac - artifacts: true - script: - - git describe --tags - - TAG_NAME=`git describe --tags` - - echo "tag name ${TAG_NAME}" - - tar -czvf ./substrate-contracts-node-linux.tar.gz ./artifacts/substrate-contracts-node-linux/substrate-contracts-node - - tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./artifacts/substrate-contracts-node-mac/substrate-contracts-node - - 'curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}"' - - 'curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" | jq .' - - 'RELEASE_ID=$(curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - | jq -r ".[] | select(.tag_name == \"$TAG_NAME\") | .id"); - echo "release id if existent: ${RELEASE_ID}"' - - 'if [ -z "$RELEASE_ID" ]; then - RESP=$(curl -X "POST" "https://api.github.com/repos/paritytech/substrate-contracts-node/releases" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/json; charset=utf-8" - -d $"{ - \"tag_name\": \"${TAG_NAME}\", - \"name\": \"${TAG_NAME}\", - \"prerelease\": false, - \"draft\": true - }"); - echo "api response ${RESP}"; - RELEASE_ID=$(echo $RESP | jq -r .id); - echo "release id of created release ${RELEASE_ID}"; - fi' - - echo "release id ${RELEASE_ID}" - - 'curl -X "POST" "https://uploads.github.com/repos/paritytech/substrate-contracts-node/releases/$RELEASE_ID/assets?name=substrate-contracts-node-linux.tar.gz" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/octet-stream" - --data-binary @"./substrate-contracts-node-linux.tar.gz"' - - 'curl -X "POST" "https://uploads.github.com/repos/paritytech/substrate-contracts-node/releases/$RELEASE_ID/assets?name=substrate-contracts-node-mac-universal.tar.gz" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/octet-stream" - --data-binary @"./substrate-contracts-node-mac-universal.tar.gz"' diff --git a/README.md b/README.md index d366a05..2810629 100644 --- a/README.md +++ b/README.md @@ -110,11 +110,15 @@ We can have two types of releases: Note: Before uploading, perform a dry run to ensure that it will be successful. - [ ] Merge the release PR branch. - [ ] Replace `XX` in this command with your incremented version number and execute it: - `git checkout main && git pull && git tag v0.XX.0 && git push origin v0.XX.0`. + ```bash + TAG="v0.XX.0" + git checkout main + git pull + git tag -a ${TAG} -m "${TAG}" + git push origin ${TAG} + ``` This will push a new tag with the version number to this repository. -- [ ] We have set this repository up in a way that tags à la `vX.X.X` trigger - a CI run that creates a GitHub draft release. You can observe CI runs on - [GitLab](https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/pipelines). +- [ ] After tag is pushed CI creates a GitHub draft release. This draft release will contain a binary for Linux and Mac and appear under [Releases](https://github.com/paritytech/substrate-contracts-node/releases). Add a description in the style of "Synchronized with [`polkadot-v1.8.0`](https://github.com/paritytech/polkadot-sdk/tree/release-polkadot-v1.8.0) branch."