diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0d6b55cfa..788ffd1e5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,19 +1,5 @@ name: Release -# READ THIS FIRST -# -# This process is by no means perfect, but it currently achieves our goals -# -# There's some magic in the `Check version match` step for each job, -# but it's there's a reason — i.e. GHA sucks — and we want to only build the package for the respective tag -# this allows us to perform individual releases instead of launching them all one by one. -# -# Now, on to the magic: -# 1 - Start by fetching the workspace metadata -# 2 - Using `jq`, get the package name and version -# and then format them into a string that should match the tag -# 4 - If it does not match the tag, fail the build - on: push: tags: @@ -25,18 +11,12 @@ concurrency: cancel-in-progress: true jobs: - build_and_release_mater_cli: + mater_cli_check_version: runs-on: self-hosted - permissions: - contents: write - packages: write - if: github.ref_type == 'tag' && startsWith(github.ref_name, 'mater-cli-v') steps: - - uses: actions/checkout@v4.2.2 - - id: check-version name: Check version match run: | @@ -51,15 +31,68 @@ jobs: exit 1; fi - # make the version available as a "checked" output in later steps echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" - - id: build-release - name: Build in release mode + outputs: + package-version: ${{ steps.check-version.outputs.PACKAGE_VERSION }} + + mater_cli_build_linux: + runs-on: self-hosted + + needs: + - mater_cli_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Build in release mode run: | RUSTFLAGS="-D warnings" cargo build --release --locked --package mater-cli echo "PACKAGE_SHA256=$(sha256sum target/release/mater-cli | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@v4 + with: + name: mater-cli-linux-${{ runner.arch }} + path: target/release/mater-cli + retention-days: 1 + + mater_cli_build_macos: + runs-on: + - macos-13 # x86 + - macos-14 # ARM + + needs: + - mater_cli_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - uses: dtolnay@rust-toolchain@1.77.0 + with: + targets: wasm32-unknown-unknown + + - name: Build in release mode + run: | + RUSTFLAGS="-D warnings" cargo build --release --locked --package mater-cli + + - uses: actions/upload-artifact@v4 + with: + name: mater-cli-macos-${{ runner.arch }} + path: target/release/mater-cli + retention-days: 1 + + mater_cli_build_docker: + runs-on: self-hosted + + needs: + - mater_cli_check_version + + permissions: + packages: write + + steps: + - uses: actions/checkout@v4.2.2 + - name: Login to Github Container Registry uses: docker/login-action@v3 with: @@ -72,38 +105,57 @@ jobs: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag ghcr.io/eigerco/mater-cli:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" \ + --tag ghcr.io/eigerco/mater-cli:"${{ needs.mater_cli_check_version.outputs.package-version }}" \ --file ./docker/dockerfiles/mater-cli.Dockerfile \ . - docker push ghcr.io/eigerco/mater-cli:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" + docker push ghcr.io/eigerco/mater-cli:"${{ needs.mater_cli_check_version.outputs.package-version }}" + + mater_cli_release: + needs: + - mater_cli_check_version + - mater_cli_build_linux + - mater_cli_build_macos + - mater_cli_build_docker + + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - id: download-artifacts + uses: actions/download-artifact@v4 + + - id: calculate-sha256 + run: | + cd ${{ steps.download-artifacts.outputs.download-path }} + echo "LINUX_X64_SHA256=${sha256sum mater-cli-linux-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_X64_SHA256=${sha256sum mater-cli-macos-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_ARM64_SHA256=${sha256sum mater-cli-macos-arm64}" >> "$GITHUB_OUTPUT" - name: Perform release uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo with: - tag_name: ${{ github.ref_name }} # set the name of the release the tag + tag_name: ${{ github.ref_name }} body: | - Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/mater-cli/?tag=${{ steps.check-version.outputs.PACKAGE_VERSION }} + Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/mater-cli?tag=${{ needs.mater_cli_check_version.outputs.package-version }} + + | Binary | SHA256 | + | ----------------------- | -------------------------------------------------------------------- | + | `mater-cli-linux-x64` | `${{ steps.calculate-sha256.outputs.LINUX_x64_SHA256 }}` | + | `mater-cli-macos-x64` | `${{ steps.calculate-sha256.outputs.MACOS_x64_SHA256 }}` | + | `mater-cli-macos-arm64` | `${{ steps.calculate-sha256.outputs.MACOS_ARM64_SHA256 }}` | - | Binary | SHA256 | - | ------------------------ | --------------------------------------------------- | - | `${{ github.ref_name }}` | `${{ steps.build-release.outputs.PACKAGE_SHA256 }}` | files: | - target/release/mater-cli + ${{steps.download-artifacts.outputs.download-path}}/mater-cli-* - build_and_release_storagext_cli: + storagext_cli_check_version: runs-on: self-hosted - permissions: - contents: write - packages: write - if: github.ref_type == 'tag' && startsWith(github.ref_name, 'storagext-cli-v') steps: - - uses: actions/checkout@v4.2.2 - - id: check-version name: Check version match run: | @@ -118,15 +170,70 @@ jobs: exit 1; fi - # make the version available as a "checked" output in later steps echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" - - id: build-release - name: Build in release mode + outputs: + package-version: ${{ steps.check-version.outputs.PACKAGE_VERSION }} + + storagext_cli_build_linux: + runs-on: self-hosted + + needs: + - storagext_cli_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Build in release mode run: | RUSTFLAGS="-D warnings" cargo build --release --locked --package storagext-cli echo "PACKAGE_SHA256=$(sha256sum target/release/storagext-cli | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@v4 + with: + name: storagext-cli-linux-${{ runner.arch }} + path: target/release/storagext-cli + retention-days: 1 + + storagext_cli_build_macos: + runs-on: + - macos-13 # x86 + - macos-14 # ARM + + needs: + - storagext_cli_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - uses: dtolnay@rust-toolchain@1.77.0 + with: + targets: wasm32-unknown-unknown + + - name: Build in release mode + run: | + RUSTFLAGS="-D warnings" cargo build --release --locked --package storagext-cli + + - uses: actions/upload-artifact@v4 + with: + name: storagext-cli-macos-${{ runner.arch }} + path: target/release/storagext-cli + retention-days: 1 + + storagext_cli_build_docker: + runs-on: self-hosted + + needs: + - storagext_cli_check_version + + permissions: + packages: write + + if: github.ref_type == 'tag' && startsWith(github.ref_name, 'storagext-cli-v') + + steps: + - uses: actions/checkout@v4.2.2 + - name: Login to Github Container Registry uses: docker/login-action@v3 with: @@ -139,38 +246,57 @@ jobs: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag ghcr.io/eigerco/storagext-cli:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" \ + --tag ghcr.io/eigerco/storagext-cli:"${{ needs.storagext_cli_check_version.outputs.package-version }}" \ --file ./docker/dockerfiles/storagext-cli.Dockerfile \ . - docker push ghcr.io/eigerco/storagext-cli:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" + docker push ghcr.io/eigerco/storagext-cli:"${{ needs.storagext_cli_check_version.outputs.package-version }}" + + storagext_cli_release: + needs: + - storagext_cli_check_version + - storagext_cli_build_linux + - storagext_cli_build_macos + - storagext_cli_build_docker + + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - id: download-artifacts + uses: actions/download-artifact@v4 + + - id: calculate-sha256 + run: | + cd ${{ steps.download-artifacts.outputs.download-path }} + echo "LINUX_X64_SHA256=${sha256sum storagext-cli-linux-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_X64_SHA256=${sha256sum storagext-cli-macos-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_ARM64_SHA256=${sha256sum storagext-cli-macos-arm64}" >> "$GITHUB_OUTPUT" - name: Perform release uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo with: - tag_name: ${{ github.ref_name }} # set the name of the release the tag + tag_name: ${{ github.ref_name }} body: | - Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/storagext-cli/?tag=${{ steps.check-version.outputs.PACKAGE_VERSION }} + Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/storagext-cli?tag=${{ needs.storagext_cli_check_version.outputs.package-version }} + + | Binary | SHA256 | + | --------------------------- | -------------------------------------------------------------------- | + | `storagext-cli-linux-x64` | `${{ steps.calculate-sha256.outputs.LINUX_x64_SHA256 }}` | + | `storagext-cli-macos-x64` | `${{ steps.calculate-sha256.outputs.MACOS_x64_SHA256 }}` | + | `storagext-cli-macos-arm64` | `${{ steps.calculate-sha256.outputs.MACOS_ARM64_SHA256 }}` | - | Binary | SHA256 | - | ------------------------ | --------------------------------------------------- | - | `${{ github.ref_name }}` | `${{ steps.build-release.outputs.PACKAGE_SHA256 }}` | files: | - target/release/storagext-cli + ${{steps.download-artifacts.outputs.download-path}}/storagext-cli-* - build_and_release_polka_storage_node: + polka_storage_node_check_version: runs-on: self-hosted - permissions: - contents: write - packages: write - if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-node-v') steps: - - uses: actions/checkout@v4.2.2 - - id: check-version name: Check version match run: | @@ -185,15 +311,68 @@ jobs: exit 1; fi - # make the version available as a "checked" output in later steps echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" - - id: build-release - name: Build in release mode + outputs: + package-version: ${{ steps.check-version.outputs.PACKAGE_VERSION }} + + polka_storage_node_build_linux: + runs-on: self-hosted + + needs: + - polka_storage_node_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Build in release mode run: | RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-node --features polka-storage-runtime/testnet echo "PACKAGE_SHA256=$(sha256sum target/release/polka-storage-node | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-node-linux-${{ runner.arch }} + path: target/release/polka-storage-node + retention-days: 1 + + polka_storage_node_build_macos: + runs-on: + - macos-13 # x86 + - macos-14 # ARM + + needs: + - polka_storage_node_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - uses: dtolnay@rust-toolchain@1.77.0 + with: + targets: wasm32-unknown-unknown + + - name: Build in release mode + run: | + RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-node + + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-node-macos-${{ runner.arch }} + path: target/release/polka-storage-node + retention-days: 1 + + polka_storage_node_build_docker: + runs-on: self-hosted + + needs: + - polka_storage_node_check_version + + permissions: + packages: write + + steps: + - uses: actions/checkout@v4.2.2 + - name: Login to Github Container Registry uses: docker/login-action@v3 with: @@ -206,60 +385,132 @@ jobs: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag ghcr.io/eigerco/polka-storage-node:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" \ + --tag ghcr.io/eigerco/polka-storage-node:"${{ needs.polka_storage_node_check_version.outputs.package-version }}" \ --file ./docker/dockerfiles/polka-storage-node.Dockerfile \ . - docker push ghcr.io/eigerco/polka-storage-node:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" + docker push ghcr.io/eigerco/polka-storage-node:"${{ needs.polka_storage_node_check_version.outputs.package-version }}" + + polka_storage_node_release: + needs: + - polka_storage_node_check_version + - polka_storage_node_build_linux + - polka_storage_node_build_macos + - polka_storage_node_build_docker + + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - id: download-artifacts + uses: actions/download-artifact@v4 + + - id: calculate-sha256 + run: | + cd ${{ steps.download-artifacts.outputs.download-path }} + echo "LINUX_X64_SHA256=${sha256sum polka-storage-node-linux-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_X64_SHA256=${sha256sum polka-storage-node-macos-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_ARM64_SHA256=${sha256sum polka-storage-node-macos-arm64}" >> "$GITHUB_OUTPUT" - name: Perform release uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo with: - tag_name: ${{ github.ref_name }} # set the name of the release the tag + tag_name: ${{ github.ref_name }} body: | - Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-node/?tag=${{ steps.check-version.outputs.PACKAGE_VERSION }} + Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-node?tag=${{ needs.polka_storage_node_check_version.outputs.package-version }} + + | Binary | SHA256 | + | -------------------------------- | ---------------------------------------------------------- | + | `polka-storage-node-linux-x64` | `${{ steps.calculate-sha256.outputs.LINUX_x64_SHA256 }}` | + | `polka-storage-node-macos-x64` | `${{ steps.calculate-sha256.outputs.MACOS_x64_SHA256 }}` | + | `polka-storage-node-macos-arm64` | `${{ steps.calculate-sha256.outputs.MACOS_ARM64_SHA256 }}` | - | Binary | SHA256 | - | ------------------------ | --------------------------------------------------- | - | `${{ github.ref_name }}` | `${{ steps.build-release.outputs.PACKAGE_SHA256 }}` | files: | - target/release/polka-storage-node + ${{steps.download-artifacts.outputs.download-path}}/polka-storage-node-* - build_and_release_polka_storage_provider_server: + polka_storage_provider_client_check_version: runs-on: self-hosted - permissions: - contents: write - packages: write - - if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-server-v') + if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-client-v') steps: - - uses: actions/checkout@v4.2.2 - - id: check-version name: Check version match run: | # used later in the build for docker tagging PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked | - jq -r '.packages[] | select(.name == "polka-storage-provider-server") | .version')" + jq -r '.packages[] | select(.name == "polka-storage-provider-client") | .version')" # used for checking the tag - PACKAGE_VERSION_WITH_NAME=$(echo "polka-storage-provider-server-v$PACKAGE_VERSION") + PACKAGE_VERSION_WITH_NAME=$(echo "polka-storage-provider-client-v$PACKAGE_VERSION") if [[ "$PACKAGE_VERSION_WITH_NAME" != "$GITHUB_REF_NAME" ]]; then exit 1; fi - # make the version available as a "checked" output in later steps echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" - - id: build-release - name: Build in release mode + outputs: + package-version: ${{ steps.check-version.outputs.PACKAGE_VERSION }} + + polka_storage_provider_client_build_linux: + runs-on: self-hosted + + needs: + - polka_storage_provider_client_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Build in release mode run: | - RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-server - echo "PACKAGE_SHA256=$(sha256sum target/release/polka-storage-provider-server | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-client + echo "PACKAGE_SHA256=$(sha256sum target/release/polka-storage-provider-client | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-provider-client-linux-${{ runner.arch }} + path: target/release/polka-storage-provider-client + retention-days: 1 + + polka_storage_provider_client_build_macos: + runs-on: + - macos-13 # x86 + - macos-14 # ARM + + needs: + - polka_storage_provider_client_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - uses: dtolnay@rust-toolchain@1.77.0 + with: + targets: wasm32-unknown-unknown + + - name: Build in release mode + run: | + RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-client + + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-provider-client-macos-${{ runner.arch }} + path: target/release/polka-storage-provider-client + retention-days: 1 + + polka_storage_provider_client_build_docker: + runs-on: self-hosted + + needs: + - polka_storage_provider_client_check_version + + permissions: + packages: write + + steps: + - uses: actions/checkout@v4.2.2 - name: Login to Github Container Registry uses: docker/login-action@v3 @@ -273,60 +524,132 @@ jobs: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag ghcr.io/eigerco/polka-storage-provider-server:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" \ - --file ./docker/dockerfiles/polka-storage-provider-server.Dockerfile \ + --tag ghcr.io/eigerco/polka-storage-provider-client:"${{ needs.polka_storage_provider_client_check_version.outputs.package-version }}" \ + --file ./docker/dockerfiles/polka-storage-provider-client.Dockerfile \ . - docker push ghcr.io/eigerco/polka-storage-provider-server:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" + docker push ghcr.io/eigerco/polka-storage-provider-client:"${{ needs.polka_storage_provider_client_check_version.outputs.package-version }}" + + polka_storage_provider_client_release: + needs: + - polka_storage_provider_client_check_version + - polka_storage_provider_client_build_linux + - polka_storage_provider_client_build_macos + - polka_storage_provider_client_build_docker + + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - id: download-artifacts + uses: actions/download-artifact@v4 + + - id: calculate-sha256 + run: | + cd ${{ steps.download-artifacts.outputs.download-path }} + echo "LINUX_X64_SHA256=${sha256sum polka-storage-provider-client-linux-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_X64_SHA256=${sha256sum polka-storage-provider-client-macos-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_ARM64_SHA256=${sha256sum polka-storage-provider-client-macos-arm64}" >> "$GITHUB_OUTPUT" - name: Perform release uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo with: - tag_name: ${{ github.ref_name }} # set the name of the release the tag + tag_name: ${{ github.ref_name }} body: | - Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-provider-server/?tag=${{ steps.check-version.outputs.PACKAGE_VERSION }} + Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-provider-client?tag=${{ needs.polka_storage_provider_client_check_version.outputs.package-version }} + + | Binary | SHA256 | + | ------------------------------------------- | ---------------------------------------------------------- | + | `polka-storage-provider-client-linux-x64` | `${{ steps.calculate-sha256.outputs.LINUX_x64_SHA256 }}` | + | `polka-storage-provider-client-macos-x64` | `${{ steps.calculate-sha256.outputs.MACOS_x64_SHA256 }}` | + | `polka-storage-provider-client-macos-arm64` | `${{ steps.calculate-sha256.outputs.MACOS_ARM64_SHA256 }}` | - | Binary | SHA256 | - | ------------------------ | --------------------------------------------------- | - | `${{ github.ref_name }}` | `${{ steps.build-release.outputs.PACKAGE_SHA256 }}` | files: | - target/release/polka-storage-provider-server + ${{steps.download-artifacts.outputs.download-path}}/polka-storage-provider-client-* - build_and_release_polka_storage_provider_client: + polka_storage_provider_server_check_version: runs-on: self-hosted - permissions: - contents: write - packages: write - - if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-client-v') + if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-server-v') steps: - - uses: actions/checkout@v4.2.2 - - id: check-version name: Check version match run: | # used later in the build for docker tagging PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked | - jq -r '.packages[] | select(.name == "polka-storage-provider-client") | .version')" + jq -r '.packages[] | select(.name == "polka-storage-provider-server") | .version')" # used for checking the tag - PACKAGE_VERSION_WITH_NAME=$(echo "polka-storage-provider-client-v$PACKAGE_VERSION") + PACKAGE_VERSION_WITH_NAME=$(echo "polka-storage-provider-server-v$PACKAGE_VERSION") if [[ "$PACKAGE_VERSION_WITH_NAME" != "$GITHUB_REF_NAME" ]]; then exit 1; fi - # make the version available as a "checked" output in later steps echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" - - id: build-release - name: Build in release mode + outputs: + package-version: ${{ steps.check-version.outputs.PACKAGE_VERSION }} + + polka_storage_provider_server_build_linux: + runs-on: self-hosted + + needs: + - polka_storage_provider_server_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Build in release mode run: | - RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-client - echo "PACKAGE_SHA256=$(sha256sum target/release/polka-storage-provider-client | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-server + echo "PACKAGE_SHA256=$(sha256sum target/release/polka-storage-provider-server | sed 's/\(.*\) .*/\1/')" >> "$GITHUB_OUTPUT" + + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-provider-server-linux-${{ runner.arch }} + path: target/release/polka-storage-provider-server + retention-days: 1 + + polka_storage_provider_server_build_macos: + runs-on: + - macos-13 # x86 + - macos-14 # ARM + + needs: + - polka_storage_provider_server_check_version + + steps: + - uses: actions/checkout@v4.2.2 + + - uses: dtolnay@rust-toolchain@1.77.0 + with: + targets: wasm32-unknown-unknown + + - name: Build in release mode + run: | + RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-providerserver- + + - uses: actions/upload-artifact@v4 + with: + name: polka-storage-provider-server-macos-${{ runner.arch }} + path: target/release/polka-storage-provider-server + retention-days: 1 + + polka_storage_provider_server_build_docker: + runs-on: self-hosted + + needs: + - polka_storage_provider_server_check_version + + permissions: + packages: write + + steps: + - uses: actions/checkout@v4.2.2 - name: Login to Github Container Registry uses: docker/login-action@v3 @@ -340,22 +663,47 @@ jobs: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag ghcr.io/eigerco/polka-storage-provider-client:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" \ - --file ./docker/dockerfiles/polka-storage-provider-client.Dockerfile \ + --tag ghcr.io/eigerco/polka-storage-provider-server:"${{ needs.polka_storage_provider_server_check_version.outputs.package-version }}" \ + --file ./docker/dockerfiles/polka-storage-provider-server.Dockerfile \ . - docker push ghcr.io/eigerco/polka-storage-provider-client:"${{ steps.check-version.outputs.PACKAGE_VERSION }}" + docker push ghcr.io/eigerco/polka-storage-provider-server:"${{ needs.polka_storage_provider_server_check_version.outputs.package-version }}" + + polka_storage_provider_server_release: + needs: + - polka_storage_provider_server_check_version + - polka_storage_provider_server_build_linux + - polka_storage_provider_server_build_macos + - polka_storage_provider_server_build_docker + + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + + steps: + - id: download-artifacts + uses: actions/download-artifact@v4 + + - id: calculate-sha256 + run: | + cd ${{ steps.download-artifacts.outputs.download-path }} + echo "LINUX_X64_SHA256=${sha256sum polka-storage-provider-server-linux-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_X64_SHA256=${sha256sum polka-storage-provider-server-macos-x64}" >> "$GITHUB_OUTPUT" + echo "MACOS_ARM64_SHA256=${sha256sum polka-storage-provider-server-macos-arm64}" >> "$GITHUB_OUTPUT" - name: Perform release uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo with: - tag_name: ${{ github.ref_name }} # set the name of the release the tag + tag_name: ${{ github.ref_name }} body: | - Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-provider-client/?tag=${{ steps.check-version.outputs.PACKAGE_VERSION }} + Docker container release: https://github.com/eigerco/polka-storage/pkgs/container/polka-storage-provider-server?tag=${{ needs.polka_storage_provider_server_check_version.outputs.package-version }} + + | Binary | SHA256 | + | ------------------------------------------- | ---------------------------------------------------------- | + | `polka-storage-provider-server-linux-x64` | `${{ steps.calculate-sha256.outputs.LINUX_x64_SHA256 }}` | + | `polka-storage-provider-server-macos-x64` | `${{ steps.calculate-sha256.outputs.MACOS_x64_SHA256 }}` | + | `polka-storage-provider-server-macos-arm64` | `${{ steps.calculate-sha256.outputs.MACOS_ARM64_SHA256 }}` | - | Binary | SHA256 | - | ------------------------ | --------------------------------------------------- | - | `${{ github.ref_name }}` | `${{ steps.build-release.outputs.PACKAGE_SHA256 }}` | files: | - target/release/polka-storage-provider-client + ${{steps.download-artifacts.outputs.download-path}}/polka-storage-provider-server-*