| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: release_server |
| |
| on: |
| workflow_call: |
| inputs: |
| tag_name: |
| description: 'The name of the tag to be released' |
| required: true |
| type: string |
| |
| env: |
| GITHUB_TOKEN: ${{ github.token }} |
| RUST_BACKTRACE: 1 |
| CARGO_TERM_COLOR: always |
| IGGY_CI_BUILD: true |
| |
| jobs: |
| release_server: |
| name: Build and release server binary |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| with: |
| fetch-depth: 0 |
| |
| - name: Install musl-tools on Linux |
| run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools |
| |
| - name: Prepare x86_64-unknown-linux-musl toolchain |
| run: | |
| rustup toolchain add --profile=minimal stable |
| rustup target add --toolchain=stable x86_64-unknown-linux-musl |
| rustup override set stable |
| |
| - name: Install cross |
| uses: taiki-e/install-action@v2 |
| with: |
| tool: cross |
| |
| - name: Build iggy-server release binary for x86_64-unknown-linux-musl |
| run: cross +stable build --verbose --target x86_64-unknown-linux-musl --release --bin iggy-server --target-dir target_x86 |
| |
| - name: Prepare x86_64-unknown-linux-musl artifacts |
| run: | |
| mkdir -p all_artifacts/Linux-x86_64 |
| cp target_x86/x86_64-unknown-linux-musl/release/iggy-server all_artifacts/Linux-x86_64/ |
| |
| - name: Prepare aarch64-unknown-linux-musl toolchain |
| run: | |
| rustup toolchain add --profile=minimal stable |
| rustup target add --toolchain=stable aarch64-unknown-linux-musl |
| rustup override set stable |
| |
| - name: Build iggy-server release binary for aarch64-unknown-linux-musl |
| run: cross +stable build --verbose --target aarch64-unknown-linux-musl --release --bin iggy-server --target-dir target_aarch64 |
| |
| - name: Prepare aarch64-unknown-linux-musl artifacts |
| run: | |
| mkdir -p all_artifacts/Linux-aarch64 |
| cp target_aarch64/aarch64-unknown-linux-musl/release/iggy-server all_artifacts/Linux-aarch64/ |
| |
| - name: Zip artifacts for each platform |
| run: | |
| mkdir zipped_artifacts |
| for dir in all_artifacts/*; do |
| if [ -d "$dir" ]; then |
| zip -r "zipped_artifacts/$(basename $dir).zip" "$dir" |
| fi |
| done |
| |
| - name: Create Changelog |
| uses: orhun/git-cliff-action@v4 |
| id: changelog |
| with: |
| config: cliff.toml |
| args: -vv --latest |
| env: |
| OUTPUT: CHANGELOG.md |
| GITHUB_REPO: ${{ github.repository }} |
| |
| - name: Create GitHub Release |
| uses: softprops/action-gh-release@v2 |
| with: |
| body: ${{ steps.changelog.outputs.content }} |
| files: | |
| zipped_artifacts/* |
| CHANGELOG.md |
| tag_name: ${{ inputs.tag_name }} |
| draft: false |
| prerelease: false |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| |
| finalize_release: |
| name: Finalize release |
| runs-on: ubuntu-latest |
| needs: |
| - release_server |
| if: always() |
| steps: |
| - name: Everything is fine |
| if: ${{ !(contains(needs.*.result, 'failure')) }} |
| run: exit 0 |
| |
| - name: Some checks failed |
| if: ${{ contains(needs.*.result, 'failure') }} |
| run: exit 1 |