Skip to content

Release 1.96.0 (#3070) #1931

Release 1.96.0 (#3070)

Release 1.96.0 (#3070) #1931

Workflow file for this run

name: Release
on:
push:
branches:
- main
# The only commits that will contain changes to the masterlist will be releases
paths:
- MASTERLIST.md
workflow_dispatch:
inputs:
# For this workflow, build-all will cause all adapters to have their image pulled and republished to the public ECR
# NOTE: If the images haven't been already published to the private ECR, this will fail; in that case run the deploy workflow first.
build-all:
description: whether to run steps for all adapters, regardless of whether they were changed in this event
required: false
default: 'false'
concurrency:
group: deploy-and-release
cancel-in-progress: false
jobs:
calculate-changes:
name: Compute changed adapters
runs-on: [self-hosted, sdlc-ghr-prod] # Running on self hosted because they're a bit faster
env:
BUILD_ALL: ${{ inputs.build-all }}
outputs:
adapter-list: ${{ steps.changed-adapters.outputs.CHANGED_ADAPTERS }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up and install dependencies
uses: ./.github/actions/setup
with:
skip-setup: true
- name: Build list of changed packages and changed adapters
id: changed-adapters
env:
UPSTREAM_BRANCH: HEAD~1
run: |
./.github/scripts/changed-adapters.sh
publish-adapter-images:
name: Fetch and publish ${{ matrix.adapter.shortName }}
runs-on: ubuntu-latest
needs:
- calculate-changes
environment: release
permissions: # These are needed for the configure-aws-credentials action
id-token: write
contents: read
strategy:
matrix: ${{fromJson(needs.calculate-changes.outputs.adapter-list)}}
env:
PUBLIC_ECR_URL: public.ecr.aws/chainlink
PRIVATE_ECR_URL: ${{ secrets.SDLC_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION_ECR_PRIVATE }}.amazonaws.com
ECR_REPO: adapters/${{ matrix.adapter.shortName }}-adapter
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Configure AWS Credentials for SDLC Private ECR
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION_ECR_PRIVATE }}
- name: Authenticate to ECR
run: aws ecr get-login-password --region ${{ secrets.AWS_REGION_ECR_PRIVATE }} | docker login --username AWS --password-stdin ${{ env.PRIVATE_ECR_URL }}/adapters/
- name: Pull adapter image from private ECR and retag with public ecr details
run: |
docker pull ${{ env.PRIVATE_ECR_URL }}/${{ env.ECR_REPO }}:${{ matrix.adapter.version }}
docker tag ${{ env.PRIVATE_ECR_URL }}/${{ env.ECR_REPO }}:${{ matrix.adapter.version }} ${{ env.PUBLIC_ECR_URL }}/${{ env.ECR_REPO }}:${{ matrix.adapter.version }}
- name: Publish adapter image to public ECR
uses: ./.github/actions/publish-image
with:
adapter-short-name: ${{ matrix.adapter.shortName }}
image-version: ${{ matrix.adapter.version }}
aws-ecr-url: ${{ env.PUBLIC_ECR_URL }}
aws-ecr-repo: ${{ env.ECR_REPO }}
aws-region: ${{ secrets.AWS_REGION_ECR_PUBLIC }}
aws-role: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-ecr-private: false
gh-release:
name: GH Release
runs-on: ubuntu-latest
needs:
- publish-adapter-images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get release version
id: get-version
run: |
echo "result=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- name: Get release body
run: |
# Get the PR body to use in the GH release body
gh pr list --search "$(git rev-parse HEAD)" --state merged --json number,body --jq '"This release was merged in PR #" + (.[0].number | tostring) + "\n" + (.[0].body | split("\n\n\n# Releases") | .[1])' > pr_body.tmp
- name: Create release
uses: actions/create-release@v1
with:
tag_name: v${{ steps.get-version.outputs.result }}
release_name: Release v${{ steps.get-version.outputs.result }}
body_path: pr_body.tmp