build-release #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Release New Version | |
| on: | |
| repository_dispatch: | |
| types: [build-release] | |
| push: | |
| paths: | |
| - '.github/workflows/build-release.yml' | |
| - '.github/workflows/call-build-linux-arm-packages.yml' | |
| - '.github/workflows/call-build-linux-x86-packages.yml' | |
| - '.github/actions/generate-package-build-matrix/*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| type: string | |
| description: "Version of the package to build" | |
| required: true | |
| environment: | |
| description: Environment to build | |
| required: true | |
| type: choice | |
| options: | |
| - dev | |
| - prod | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| process-inputs: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.process-inputs.outputs.version }} | |
| environment: ${{ steps.process-inputs.outputs.environment }} | |
| trigger_bundle: ${{ steps.process-inputs.outputs.trigger_bundle }} | |
| steps: | |
| - name: Process and validate inputs | |
| id: process-inputs | |
| run: | | |
| # Determine the event type | |
| if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then | |
| VERSION=${{ github.event.client_payload.version }} | |
| ENVIRONMENT=${{ github.event.client_payload.environment }} | |
| elif [[ "${{ github.event_name }}" == "push" ]]; then | |
| VERSION="unstable" | |
| ENVIRONMENT="dev" | |
| else | |
| VERSION=${{ github.event.inputs.version }} | |
| ENVIRONMENT=${{ github.event.inputs.environment }} | |
| fi | |
| # Validate version | |
| if [[ ! "$VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?|unstable)$ ]]; then | |
| echo "Invalid version format. Expected format: x.y.z, x.y.z-rcN, or 'unstable'." | |
| exit 1 | |
| fi | |
| # Default environment to 'dev' if not provided for safety. Environment is made non-optional. | |
| if [[ -z "$ENVIRONMENT" ]]; then | |
| ENVIRONMENT="dev" | |
| fi | |
| # Validate environment | |
| if [[ "$ENVIRONMENT" != "dev" && "$ENVIRONMENT" != "prod" ]]; then | |
| echo "Invalid environment. Allowed values: 'dev', 'prod'." | |
| exit 1 | |
| fi | |
| TRIGGER_BUNDLE="false" | |
| if [[ "$VERSION" != "unstable" ]]; then | |
| VERSION_WITHOUT_RC=$(echo "$VERSION" | sed 's/-rc[0-9]*$//') | |
| MAJOR=$(echo "$VERSION_WITHOUT_RC" | cut -d. -f1) | |
| MINOR=$(echo "$VERSION_WITHOUT_RC" | cut -d. -f2) | |
| # Check if version is >= 8.1.0 | |
| if [[ "$MAJOR" -gt 8 ]] || [[ "$MAJOR" -eq 8 && "$MINOR" -ge 1 ]]; then | |
| TRIGGER_BUNDLE="true" | |
| else | |
| echo "Version $VERSION is < 8.1.0 which is incompatible with Valkey Bundle so we won't trigger the Bundle release" | |
| fi | |
| fi | |
| # Output validated variables | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT | |
| echo "trigger_bundle=$TRIGGER_BUNDLE" >> $GITHUB_OUTPUT | |
| update-valkey-hashes: | |
| needs: | |
| - process-inputs | |
| if: needs.process-inputs.outputs.environment == 'prod' | |
| uses: ./.github/workflows/update-valkey-hashes.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| secrets: | |
| PAT_TOKEN: ${{ secrets.AUTOMATION_PAT }} | |
| update-valkey-container: | |
| needs: | |
| - process-inputs | |
| - update-valkey-hashes | |
| if: needs.process-inputs.outputs.environment == 'prod' | |
| uses: ./.github/workflows/update-valkey-container.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| secrets: | |
| PAT_TOKEN: ${{ secrets.AUTOMATION_PAT }} | |
| update-valkey-doc: | |
| needs: | |
| - process-inputs | |
| - update-valkey-hashes | |
| if: needs.process-inputs.outputs.environment == 'prod' | |
| uses: ./.github/workflows/update-valkey-doc.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| secrets: | |
| PAT_TOKEN: ${{ secrets.AUTOMATION_PAT }} | |
| generate-build-matrix: | |
| needs: | |
| - process-inputs | |
| name: Generating build matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| x86_64-build-matrix: ${{ steps.set-matrix.outputs.x86_64-build-matrix }} | |
| arm64-build-matrix: ${{ steps.set-matrix.outputs.arm64-build-matrix }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/generate-package-build-matrix | |
| id: set-matrix | |
| with: | |
| ref: ${{ needs.process-inputs.outputs.version }} | |
| release-build-linux-x86-packages: | |
| needs: | |
| - generate-build-matrix | |
| - process-inputs | |
| uses: ./.github/workflows/call-build-linux-x86-packages.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| build_matrix: ${{ needs.generate-build-matrix.outputs.x86_64-build-matrix }} | |
| region: us-west-2 | |
| secrets: | |
| bucket_name: ${{ needs.process-inputs.outputs.environment == 'dev' && secrets.AWS_TEST_BUCKET || secrets.AWS_S3_BUCKET }} | |
| role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
| release-build-linux-arm-packages: | |
| needs: | |
| - generate-build-matrix | |
| - process-inputs | |
| uses: ./.github/workflows/call-build-linux-arm-packages.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| build_matrix: ${{ needs.generate-build-matrix.outputs.arm64-build-matrix }} | |
| region: us-west-2 | |
| secrets: | |
| bucket_name: ${{ needs.process-inputs.outputs.environment == 'dev' && secrets.AWS_TEST_BUCKET || secrets.AWS_S3_BUCKET }} | |
| role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
| update-try-valkey: | |
| needs: | |
| - process-inputs | |
| - update-valkey-hashes | |
| if: needs.process-inputs.outputs.environment == 'prod' | |
| uses: ./.github/workflows/update-try-valkey.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| region: us-west-2 | |
| secrets: inherit | |
| update-valkey-website: | |
| needs: | |
| - process-inputs | |
| - update-valkey-hashes | |
| - update-valkey-container | |
| - update-try-valkey | |
| if: needs.process-inputs.outputs.environment == 'prod' | |
| uses: ./.github/workflows/update-valkey-website.yml | |
| with: | |
| version: ${{ needs.process-inputs.outputs.version }} | |
| bashbrew_json: ${{ needs.update-valkey-container.outputs.bashbrew_output }} | |
| try_valkey_uploaded: ${{ needs.update-try-valkey.outputs.try_valkey_uploaded }} | |
| secrets: | |
| PAT_TOKEN: ${{ secrets.AUTOMATION_PAT }} | |
| trigger-valkey-bundle: | |
| needs: | |
| - process-inputs | |
| - update-valkey-container | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Trigger Valkey Bundle Update | |
| if: needs.process-inputs.outputs.trigger_bundle == 'true' | |
| uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # Version 3 | |
| with: | |
| token: ${{ secrets.AUTOMATION_PAT }} | |
| repository: ${{ github.repository_owner }}/valkey-bundle | |
| event-type: valkey-release | |
| client-payload: > | |
| { | |
| "version": "${{ needs.process-inputs.outputs.version }}", | |
| "component": "valkey" | |
| } |