From d04dbac71e9e9f6b808c912015be90c668b7a64e Mon Sep 17 00:00:00 2001 From: Alexander Shevtsov <1616179+randomlogin@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:51:54 +0200 Subject: [PATCH 1/3] Added release github workflows --- .github/workflows/release-linux.yml | 61 ++++++++++++++++++++++ .github/workflows/release-macos-arm.yml | 60 +++++++++++++++++++++ .github/workflows/release-macos-x86_64.yml | 60 +++++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 .github/workflows/release-linux.yml create mode 100644 .github/workflows/release-macos-arm.yml create mode 100644 .github/workflows/release-macos-x86_64.yml diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml new file mode 100644 index 0000000..5276ad9 --- /dev/null +++ b/.github/workflows/release-linux.yml @@ -0,0 +1,61 @@ +name: Release linux (x86_64) + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Dynamically create a tag from the pushed version + - name: Get the tag name + id: get_tag + run: | + echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build release binary + run: cargo build --release + + # Perhaps we can ignore tests, as they are run by the CI workflow + # - name: Run tests + # run: cargo test --release + # + + - name: Get OS and architecture + run: | + echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + echo "arch=$(uname -m)" >> $GITHUB_ENV + + - name: Create release archive + run: | + mkdir -p release + ARCH="${{ env.arch }}" + OS="${{ env.os }}" + cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} + cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} + + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.TAG }} # Dynamically use the pushed tag + name: Release ${{ env.TAG }} # Use the tag for the release name + body: | + Automated release of version ${{ env.TAG }}. + draft: false + prerelease: false + files: | + release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + make_latest: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-macos-arm.yml b/.github/workflows/release-macos-arm.yml new file mode 100644 index 0000000..04d7560 --- /dev/null +++ b/.github/workflows/release-macos-arm.yml @@ -0,0 +1,60 @@ +name: Release macOs (arm) + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Dynamically create a tag from the pushed version + - name: Get the tag name + id: get_tag + run: | + echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build release binary + run: cargo build --release + + # Perhaps we can ignore tests, as they are run by the CI workflow + # - name: Run tests + # run: cargo test --release + + - name: Get OS and architecture + run: | + echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + echo "arch=$(uname -m)" >> $GITHUB_ENV + + - name: Create release archive + run: | + mkdir -p release + ARCH="${{ env.arch }}" + OS="${{ env.os }}" + cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} + cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} + + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.TAG }} # Dynamically use the pushed tag + name: Release ${{ env.TAG }} # Use the tag for the release name + body: | + Automated release of version ${{ env.TAG }}. + draft: false + prerelease: false + files: | + release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + make_latest: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-macos-x86_64.yml b/.github/workflows/release-macos-x86_64.yml new file mode 100644 index 0000000..7530d1a --- /dev/null +++ b/.github/workflows/release-macos-x86_64.yml @@ -0,0 +1,60 @@ +name: Release macOs (x86_64) + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: macos-13 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Dynamically create a tag from the pushed version + - name: Get the tag name + id: get_tag + run: | + echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build release binary + run: cargo build --release + + # Perhaps we can ignore tests, as they are run by the CI workflow + # - name: Run tests + # run: cargo test --release + + - name: Get OS and architecture + run: | + echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + echo "arch=$(uname -m)" >> $GITHUB_ENV + + - name: Create release archive + run: | + mkdir -p release + ARCH="${{ env.arch }}" + OS="${{ env.os }}" + cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} + cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} + + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.TAG }} # Dynamically use the pushed tag + name: Release ${{ env.TAG }} # Use the tag for the release name + body: | + Automated release of version ${{ env.TAG }}. + draft: false + prerelease: false + files: | + release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} + make_latest: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c663cb94bcafd20401ed6f3477c3ce95b00f0af7 Mon Sep 17 00:00:00 2001 From: Alexander Shevtsov Date: Tue, 22 Oct 2024 17:56:51 +0200 Subject: [PATCH 2/3] changed default release text --- .github/workflows/release-linux.yml | 2 +- .github/workflows/release-macos-arm.yml | 2 +- .github/workflows/release-macos-x86_64.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 5276ad9..979f947 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -50,7 +50,7 @@ jobs: tag_name: ${{ env.TAG }} # Dynamically use the pushed tag name: Release ${{ env.TAG }} # Use the tag for the release name body: | - Automated release of version ${{ env.TAG }}. + Spaces release of version ${{ env.TAG }}. draft: false prerelease: false files: | diff --git a/.github/workflows/release-macos-arm.yml b/.github/workflows/release-macos-arm.yml index 04d7560..411292e 100644 --- a/.github/workflows/release-macos-arm.yml +++ b/.github/workflows/release-macos-arm.yml @@ -49,7 +49,7 @@ jobs: tag_name: ${{ env.TAG }} # Dynamically use the pushed tag name: Release ${{ env.TAG }} # Use the tag for the release name body: | - Automated release of version ${{ env.TAG }}. + Spaces release of version ${{ env.TAG }}. draft: false prerelease: false files: | diff --git a/.github/workflows/release-macos-x86_64.yml b/.github/workflows/release-macos-x86_64.yml index 7530d1a..f8c608f 100644 --- a/.github/workflows/release-macos-x86_64.yml +++ b/.github/workflows/release-macos-x86_64.yml @@ -49,7 +49,7 @@ jobs: tag_name: ${{ env.TAG }} # Dynamically use the pushed tag name: Release ${{ env.TAG }} # Use the tag for the release name body: | - Automated release of version ${{ env.TAG }}. + Spaces release of version ${{ env.TAG }}. draft: false prerelease: false files: | From 02dd1ca171b9bd7d953a772aff00567ddd689654 Mon Sep 17 00:00:00 2001 From: Alexander Shevtsov Date: Tue, 22 Oct 2024 19:03:05 +0200 Subject: [PATCH 3/3] Moved all build workflows into one --- .github/workflows/release-macos-arm.yml | 60 ------------------- .github/workflows/release-macos-x86_64.yml | 60 ------------------- .../{release-linux.yml => release.yml} | 7 ++- 3 files changed, 5 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/release-macos-arm.yml delete mode 100644 .github/workflows/release-macos-x86_64.yml rename .github/workflows/{release-linux.yml => release.yml} (90%) diff --git a/.github/workflows/release-macos-arm.yml b/.github/workflows/release-macos-arm.yml deleted file mode 100644 index 411292e..0000000 --- a/.github/workflows/release-macos-arm.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Release macOs (arm) - -on: - push: - tags: - - 'v*.*.*' - -jobs: - release: - runs-on: macos-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Dynamically create a tag from the pushed version - - name: Get the tag name - id: get_tag - run: | - echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - - - name: Set up Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Build release binary - run: cargo build --release - - # Perhaps we can ignore tests, as they are run by the CI workflow - # - name: Run tests - # run: cargo test --release - - - name: Get OS and architecture - run: | - echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - echo "arch=$(uname -m)" >> $GITHUB_ENV - - - name: Create release archive - run: | - mkdir -p release - ARCH="${{ env.arch }}" - OS="${{ env.os }}" - cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} - cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} - - - name: Create GitHub Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ env.TAG }} # Dynamically use the pushed tag - name: Release ${{ env.TAG }} # Use the tag for the release name - body: | - Spaces release of version ${{ env.TAG }}. - draft: false - prerelease: false - files: | - release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} - release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} - make_latest: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-macos-x86_64.yml b/.github/workflows/release-macos-x86_64.yml deleted file mode 100644 index f8c608f..0000000 --- a/.github/workflows/release-macos-x86_64.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Release macOs (x86_64) - -on: - push: - tags: - - 'v*.*.*' - -jobs: - release: - runs-on: macos-13 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Dynamically create a tag from the pushed version - - name: Get the tag name - id: get_tag - run: | - echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - - - name: Set up Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Build release binary - run: cargo build --release - - # Perhaps we can ignore tests, as they are run by the CI workflow - # - name: Run tests - # run: cargo test --release - - - name: Get OS and architecture - run: | - echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - echo "arch=$(uname -m)" >> $GITHUB_ENV - - - name: Create release archive - run: | - mkdir -p release - ARCH="${{ env.arch }}" - OS="${{ env.os }}" - cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} - cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} - - - name: Create GitHub Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ env.TAG }} # Dynamically use the pushed tag - name: Release ${{ env.TAG }} # Use the tag for the release name - body: | - Spaces release of version ${{ env.TAG }}. - draft: false - prerelease: false - files: | - release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} - release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} - make_latest: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release.yml similarity index 90% rename from .github/workflows/release-linux.yml rename to .github/workflows/release.yml index 979f947..c76d22d 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release linux (x86_64) +name: Build binaries and create release on: push: @@ -7,7 +7,10 @@ on: jobs: release: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, macos-13] # Specify the runners you want to use steps: - name: Checkout repository