Skip to content

Local testing

Local testing #1984

Workflow file for this run

name: Release
on:
pull_request:
paths:
- 'packages/sources/**'
- 'packages/composites/**'
- 'packages/targets/**'
- 'packages/core/**'
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: [ubuntu-latest]
env:
BUILD_ALL: ${{ inputs.build-all }}
outputs:
adapter-list: ${{ steps.changed-adapters.outputs.CHANGED_ADAPTERS }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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:
max-parallel: 20
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Configure AWS Credentials for SDLC Private ECR
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION_ECR_PRIVATE }}
mask-aws-account-id: true
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# - 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: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
# with:
# tag_name: v${{ steps.get-version.outputs.result }}
# name: Release v${{ steps.get-version.outputs.result }}
# body_path: pr_body.tmp