v21-alpha #27
Workflow file for this run
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: release | |
| on: | |
| release: | |
| types: [ created ] | |
| jobs: | |
| build: | |
| name: build ${{ matrix.arch }} | |
| strategy: | |
| matrix: | |
| arch: [x86-64, arm64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: update apt cache | |
| run: sudo apt-get update | |
| - name: install protoc | |
| run: sudo apt-get install -y protobuf-compiler | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| rustflags: "" | |
| - name: install cargo lambda | |
| run: | | |
| pip3 install cargo-lambda | |
| - name: Set build env | |
| run: echo "BUILD_SHORT_SHA=$(echo -n $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV | |
| - name: build | |
| run: cargo lambda build --extension --release --${{ matrix.arch }} --lambda-dir target/lambda/${{ matrix.arch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: extensions-${{github.ref_name}}-${{ matrix.arch }} | |
| path: target/lambda/ | |
| overwrite: true | |
| release: | |
| name: release ${{ matrix.arch }} to ${{ matrix.region }} | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [ x86-64, arm64 ] | |
| # Start with a small set of popular regions, expand as necessary. | |
| # Note: As we expand these we may need to pre-create the old version numbers so that the | |
| # latest lambda layer version matches across all regions. That is left as a TODO. | |
| region: [ us-east-1, us-east-2, us-west-2, eu-central-1, ap-southeast-2 ] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: extensions-${{github.ref_name}}-${{ matrix.arch }} | |
| path: target/lambda/ | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| rustflags: "" | |
| - name: install cargo lambda | |
| run: | | |
| pip3 install cargo-lambda | |
| - name: set amd64 arch suffix | |
| if: matrix.arch == 'x86-64' | |
| run: echo 'EXT_ARCH_SUFFIX=-amd64' >> $GITHUB_ENV | |
| - name: set arm64 arch suffix | |
| if: matrix.arch == 'arm64' | |
| run: echo 'EXT_ARCH_SUFFIX=-arm64' >> $GITHUB_ENV | |
| - name: set version suffix | |
| if: contains(github.ref_name, 'alpha') | |
| run: echo 'EXT_VERSION_SUFFIX=-alpha' >> $GITHUB_ENV | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_LAMBDA_DEPLOY_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - name: deploy | |
| env: | |
| AWS_REGION: ${{matrix.region}} # Shouldn't need, but doesn't seem to respect CLI? | |
| run: | | |
| cargo lambda deploy --extension --region ${{matrix.region}} --lambda-dir target/lambda/${{ matrix.arch }} \ | |
| --compatible-runtimes provided.al2023 --binary-name rotel-extension \ | |
| "rotel-extension${EXT_ARCH_SUFFIX}${EXT_VERSION_SUFFIX}" | tee -a /tmp/lambda-deploy.out | |
| - name: publish release | |
| run: | | |
| ./scripts/publish-lambda-version.sh $( grep 'extension arn' /tmp/lambda-deploy.out | awk '{print $4}' ) |