diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 964fab56..d1f82675 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,6 +59,7 @@ jobs: uses: actions/checkout@v2 - name: Restore from cache and run vcpkg + if: ${{ matrix.platform == 'win' }} uses: lukka/run-vcpkg@v7 with: vcpkgArguments: openssl diff --git a/.github/workflows/release-ext.yml b/.github/workflows/release-ext.yml deleted file mode 100644 index 6aae526e..00000000 --- a/.github/workflows/release-ext.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build Release Ext -on: - workflow_run: - workflows: [Create Release Page] - types: [completed] - -env: - RUSTFLAGS: -D warnings - CARGO_INCREMENTAL: 0 - RUSTUP_MAX_RETRIES: 10 - CARGO_NET_RETRY: 10 - -jobs: - release: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: get release info - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: release assets url - - name: read release info - id: release - run: | - echo ::set-output name=tag::$(cat release-upload.url | cut -d \ -f 1) - echo ::set-output name=upload_url::$(cat release-upload.url | cut -d \ -f 2) - outputs: - tag: ${{ steps.release.outputs.tag }} - upload_url: ${{ steps.release.outputs.upload_url }} diff --git a/.github/workflows/release-new.yml b/.github/workflows/release-new.yml deleted file mode 100644 index 7a6de9d7..00000000 --- a/.github/workflows/release-new.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Create Release Page -on: - push: - tags: - - v?[0-9]+.[0-9]+.* - -jobs: - release: - name: Release page - runs-on: ubuntu-latest - defaults: - run: - shell: bash - - steps: - - name: Extract the version tag - id: version - run: echo ::set-output name=value::$(echo $GITHUB_REF | cut -d / -f 3) - - # checkout needed for changelog only - - name: Checkout - uses: actions/checkout@v2 - with: { fetch-depth: 0 } - - - id: changelog - name: Generate Changelog - continue-on-error: true - run: | - TAG_FIRST=$(git describe --abbrev=0 --tags $(git describe --abbrev=0)^) - TAG_SECOND=$(git describe --abbrev=0) - echo "Generating changelog between tags: ${{ steps.version.outputs.value }}...$TAG_FIRST...$TAG_SECOND" - - RESULT_FILE=generated-changelog.md - RESULT_LOG_ACT="$(git log $TAG_SECOND...${{ steps.version.outputs.value }} --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)" - RESULT_LOG_POST="$(git log $TAG_FIRST...$TAG_SECOND --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)" - - echo " - ## TODO: EDIT ME BEFORE PUBLISH - - [link-tools]: ${{ github.event.repository.html_url }}/actions?query=workflow%3A%22Build+Release+Tools%22 - [link-ext]: ${{ github.event.repository.html_url }}/actions?query=workflow%3A%22Build+Release+Ext%22 - [badge-tools]: ${{ github.event.repository.html_url }}/workflows/Build%20Release%20Tools/badge.svg?event=workflow_run (tools workflow) - [badge-ext]: ${{ github.event.repository.html_url }}/workflows/Build%20Release%20Ext/badge.svg?event=workflow_run (ext workflow) - - __Please wait build completions for:__ - - [![Build Release Tools][badge-tools]][link-tools] - - [![Build Release Ext][badge-ext]][link-ext] - - - - - - - __Changelog ${{ steps.version.outputs.value }}__…${TAG_SECOND} - - $RESULT_LOG_ACT - - __Changelog ${TAG_SECOND}__…${TAG_FIRST} - - $RESULT_LOG_POST - - - " > $RESULT_FILE - - # echo ::set-output name=tag_from::"$TAG_FIRST" - # echo ::set-output name=tag_to::"$TAG_SECOND" - echo ::set-output name=file::"$RESULT_FILE" - # echo ::set-output name=text::$RESULT_LOG - - - id: release - name: Create release ${{ steps.version.outputs.value }} - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - draft: true - prerelease: true - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body_path: ${{ steps.changelog.outputs.file }} - - - name: Save release assets url for other workflows - run: echo "${{ steps.version.outputs.value }} ${{ steps.release.outputs.upload_url }}" > release-upload.url - - - name: Set release assets url as artifact - uses: actions/upload-artifact@v2 - with: - name: release assets url - path: release-upload.url - if-no-files-found: error - retention-days: 1 - - outputs: - tag: ${{ steps.version.outputs.value }} - upload_url: ${{ steps.release.outputs.upload_url }} -# -# # example post-create-release job: -# build: -# needs: release -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# os: -# - ubuntu-latest -# - macos-latest -# - windows-latest -# defaults: -# run: -# shell: bash -# steps: -# - name: release url -# run: echo "${{ needs.release.outputs.upload_url }}" diff --git a/.github/workflows/release-tools.yml b/.github/workflows/release-tools.yml deleted file mode 100644 index 80763b5e..00000000 --- a/.github/workflows/release-tools.yml +++ /dev/null @@ -1,208 +0,0 @@ -name: Build Release Tools -on: - workflow_run: - workflows: [Create Release Page] - types: [completed] - -env: - RUSTFLAGS: -D warnings - CARGO_INCREMENTAL: 0 - RUSTUP_MAX_RETRIES: 10 - CARGO_NET_RETRY: 10 - -jobs: - release: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: get release info - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: release assets url - - name: read release info - id: release - run: | - echo ::set-output name=tag::$(cat release-upload.url | cut -d \ -f 1) - echo ::set-output name=upload_url::$(cat release-upload.url | cut -d \ -f 2) - outputs: - tag: ${{ steps.release.outputs.tag }} - upload_url: ${{ steps.release.outputs.upload_url }} - - build: - runs-on: ${{ matrix.os }} - needs: release - - strategy: - fail-fast: false - matrix: - include: - - platform: darwin - os: macos-latest - triplet: x64-osx - - platform: linux - os: ubuntu-latest - triplet: x64-linux - - platform: win - os: windows-latest - triplet: x64-windows-static-md - - defaults: - run: - shell: bash - - steps: - - name: Checkout (${{ needs.release.outputs.tag }}-${{ github.event.workflow_run.head_sha }}) - uses: actions/checkout@v2 - with: - ref: ${{ github.event.workflow_run.head_sha }} - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: Restore from cache and run vcpkg - uses: lukka/run-vcpkg@v7 - with: - vcpkgArguments: openssl - vcpkgDirectory: ${{github.workspace}}/3rdparty/vcpkg - vcpkgTriplet: ${{ matrix.triplet }} - vcpkgGitCommitId: 92bbf7b3315172d63ffa58416e7cf3f05d8da8e6 - - - name: Build all executables - if: matrix.os != 'windows-latest' - run: cargo build --release --all --bins - - name: Build all executables - if: matrix.os == 'windows-latest' - run: > - cargo build --release --bins - -p=dove - - - id: dove - name: get version of dove - uses: ./.github/actions/crate-version - with: { crate: dove } - - - id: mrv - if: matrix.os != 'windows-latest' - name: get version of resource-viewer - uses: ./.github/actions/crate-version - with: { crate: move-resource-viewer } - - - if: ${{ matrix.platform == 'win' }} - name: set up standard executable ext for ${{ matrix.platform }} - run: echo "OS_BIN_EXT=.exe" >> $GITHUB_ENV - - - name: save build info - id: build-info - run: | - uname -a > build-info.txt - rustc -V >> build-info.txt - echo "::set-output name=arch::$(uname -m)" - - - name: prepare dist dirs - id: dist - run: | - RELEASE_DIR=./target/release - DIST_DIR=$RELEASE_DIR/dist - mkdir -p $DIST_DIR - echo "::set-output name=build::$RELEASE_DIR" - echo "::set-output name=dist::$DIST_DIR" - - - name: prepare toolchain - id: toolchain - run: | - echo "git-tag r '$GITHUB_REF'" - echo "git-tag d '$(git describe --tags)'" - echo "tag by release ${{ needs.release.outputs.tag }}" - - ARCH="${{ steps.build-info.outputs.arch }}" - RELEASE_DIR=${{ steps.dist.outputs.build }} - DIST_DIR=${{ steps.dist.outputs.dist }} - PKG_NAME="move-toolchain-${{ needs.release.outputs.tag }}-${{ matrix.platform }}-$ARCH" - PKG_DIR=$DIST_DIR/$PKG_NAME - PKG_BIN_DIR=$PKG_DIR/bin - - DOVE_NAME=dove$OS_BIN_EXT - - mkdir -p $PKG_BIN_DIR - cp build-info.txt $PKG_DIR/ - - set +e - cp $RELEASE_DIR/dove$OS_BIN_EXT $PKG_BIN_DIR/$DOVE_NAME - set -e - - echo "::set-output name=name::$PKG_NAME" - echo "::set-output name=path::$PKG_DIR" - - - name: archive toolchain - id: archive - uses: ./.github/actions/archive - with: - name: ${{ steps.toolchain.outputs.name }} - path: ${{ steps.toolchain.outputs.path }} - - - name: prepare standalone executables - id: artifact - run: | - ARCH="${{ steps.build-info.outputs.arch }}" - RELEASE_DIR=${{ steps.dist.outputs.build }} - - DOVE_NAME=dove-${{ steps.dove.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT - cd $RELEASE_DIR - - set +e - mv move-language-server$OS_BIN_EXT $MLS_NAME - mv move-resource-viewer$OS_BIN_EXT $MRV_NAME - mv dove$OS_BIN_EXT $DOVE_NAME - set -e - - echo "::set-output name=mrv::$MRV_NAME" - echo "::set-output name=dove::$DOVE_NAME" - echo "::set-output name=mrv_path::$RELEASE_DIR/$MRV_NAME" - echo "::set-output name=dove_path::$RELEASE_DIR/$DOVE_NAME" - - - name: upload Toolchain - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ${{ steps.archive.outputs.path }} - asset_name: ${{ steps.archive.outputs.name }} - asset_content_type: application/gzip - - - name: upload MLS - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ${{ steps.artifact.outputs.mls_path }} - asset_name: ${{ steps.artifact.outputs.mls }} - asset_content_type: application/gzip - - - name: upload MRV - if: matrix.os != 'windows-latest' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ${{ steps.artifact.outputs.mrv_path }} - asset_name: ${{ steps.artifact.outputs.mrv }} - asset_content_type: application/gzip - - - name: upload dove - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ${{ steps.artifact.outputs.dove_path }} - asset_name: ${{ steps.artifact.outputs.dove }} - asset_content_type: application/gzip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4a6f38c1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,187 @@ +name: Release +on: + push: + tags: + - v?[0-9]+.[0-9]+.* + workflow_call: + inputs: + tag: + description: Target tag + required: true + type: string + +jobs: + release: + name: page + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + - name: Extract the version tag + id: version + run: | + if [ -z "${{ inputs.tag }}" ]; then + echo ::set-output name=value::$(echo $GITHUB_REF | cut -d / -f 3) + else + echo ::set-output name=value::${{ inputs.tag }} + fi + + # checkout needed for changelog only + - name: Checkout + uses: actions/checkout@v2 + with: { fetch-depth: 0 } + + - id: changelog + name: Generate Changelog + continue-on-error: true + run: | + TAG_FIRST=$(git describe --abbrev=0 --tags $(git describe --abbrev=0)^) + TAG_SECOND=$(git describe --abbrev=0) + echo "Generating changelog between tags: ${{ steps.version.outputs.value }}...$TAG_FIRST...$TAG_SECOND" + + RESULT_FILE=generated-changelog.md + RESULT_LOG_ACT="$(git log $TAG_SECOND...${{ steps.version.outputs.value }} --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)" + RESULT_LOG_POST="$(git log $TAG_FIRST...$TAG_SECOND --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)" + + echo " + ## TODO: EDIT ME BEFORE PUBLISH + + [link-tools]: ${{ github.event.repository.html_url }}/actions?query=workflow%3A%22Release%22 + [badge-tools]: ${{ github.event.repository.html_url }}/workflows/Release/badge.svg?event=push_tag (tools workflow) + + __Please wait build completions for:__ + - [![Build Release][badge-tools]][link-tools] + + - - - + + __Changelog ${{ steps.version.outputs.value }}__…${TAG_SECOND} + + $RESULT_LOG_ACT + + __Changelog ${TAG_SECOND}__…${TAG_FIRST} + + $RESULT_LOG_POST + + + " > $RESULT_FILE + + # echo ::set-output name=tag_from::"$TAG_FIRST" + # echo ::set-output name=tag_to::"$TAG_SECOND" + echo ::set-output name=file::"$RESULT_FILE" + # echo ::set-output name=text::$RESULT_LOG + + - id: release + name: Create release ${{ steps.version.outputs.value }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + draft: true + prerelease: true + tag_name: ${{ steps.version.outputs.value }} + release_name: ${{ steps.version.outputs.value }} + body_path: ${{ steps.changelog.outputs.file }} + + - name: Save release assets url for other workflows + run: echo "${{ steps.version.outputs.value }} ${{ steps.release.outputs.upload_url }}" > release-upload.url + + - name: Set release assets url as artifact + uses: actions/upload-artifact@v2 + with: + name: release assets url + path: release-upload.url + if-no-files-found: error + retention-days: 1 + + outputs: + tag: ${{ steps.version.outputs.value }} + upload_url: ${{ steps.release.outputs.upload_url }} + + build: + needs: release + runs-on: ${{ matrix.os }} + name: ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + include: + - platform: darwin + os: macos-latest + triplet: x64-osx + - platform: linux + os: ubuntu-latest + triplet: x64-linux + # - platform: win + # os: windows-latest + # triplet: x64-windows-static-md + defaults: + run: + shell: bash + steps: + - name: Checkout (${{ needs.release.outputs.tag }} + uses: actions/checkout@v2 + with: + ref: ${{ needs.release.outputs.tag }} + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: false + + - name: Restore from cache and run vcpkg + if: ${{ matrix.platform == 'win' }} + uses: lukka/run-vcpkg@v7 + with: + vcpkgArguments: openssl + vcpkgDirectory: ${{github.workspace}}/3rdparty/vcpkg + vcpkgTriplet: ${{ matrix.triplet }} + vcpkgGitCommitId: 92bbf7b3315172d63ffa58416e7cf3f05d8da8e6 + + - name: Build + run: cargo build --release --bin=dove + + - id: dove + name: version of dove + uses: ./.github/actions/crate-version + with: { crate: dove } + + - if: ${{ matrix.platform == 'win' }} + name: set up standard executable ext for ${{ matrix.platform }} + run: echo "OS_BIN_EXT=.exe" >> $GITHUB_ENV + + - name: build info + id: build-info + run: | + uname -a > build-info.txt + rustc -V >> build-info.txt + echo "::set-output name=arch::$(uname -m)" + + - name: prepare standalone executables + id: artifact + run: | + ARCH="${{ steps.build-info.outputs.arch }}" + RELEASE_DIR=target/release + + DOVE_NAME=dove-${{ steps.dove.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT + cd $RELEASE_DIR + + set +e + mv dove$OS_BIN_EXT $DOVE_NAME + set -e + + echo "::set-output name=dove::$DOVE_NAME" + echo "::set-output name=dove_path::$RELEASE_DIR/$DOVE_NAME" + + - name: upload dove + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ${{ steps.artifact.outputs.dove_path }} + asset_name: ${{ steps.artifact.outputs.dove }} + asset_content_type: application/gzip diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml new file mode 100644 index 00000000..ca57c266 --- /dev/null +++ b/.github/workflows/tag-version.yml @@ -0,0 +1,36 @@ +name: Release (Version) +on: + push: + branches: + - master + +jobs: + push-tag: + name: Tag crate version + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - id: new_tag + name: try create tag + uses: pontem-network/tag-crate-version@main + with: + crate: dove + version-to-tag: "$1" + token: ${{ secrets.GITHUB_TOKEN }} + + outputs: + crate: ${{ steps.new_tag.outputs.crate }} + version: ${{ steps.new_tag.outputs.current }} + tag: ${{ steps.new_tag.outputs.tag }} + prev-tag: ${{ steps.new_tag.outputs.previous }} + success: ${{ steps.new_tag.outputs.success }} + + release: + needs: push-tag + if: needs.push-tag.outputs.success + uses: pontem-network/move-tools/.github/workflows/release.yml@master + # SHOULD uses: ${{ github.event.repository.full_name }}/.github/workflows/release.yml@${{ github.ref }} or ${{ needs.push-tag.outputs.tag }} + with: + tag: ${{ needs.push-tag.outputs.tag }}