1.3.27 #43
Workflow file for this run
This file contains 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: Released | |
on: | |
release: | |
types: | |
- released | |
env: | |
COMPONENT: aws-adapter | |
COMPONENT_PATH: distributions/aws/ | |
PRIVATE_ECR_REGION: ${{ secrets.AWS_ECR_REGION }} | |
ECR_ROLE_ARN: ${{ secrets.AWS_ECR_ROLE_ARN }} | |
DOCKER_REPOSITORY: aws-adapter | |
CONTAINER: aws-adapter-container-image | |
permissions: | |
id-token: write | |
contents: read | |
packages: read | |
jobs: | |
cancel_previous: | |
name: 'Cancel Previous Runs' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 3 | |
steps: | |
- uses: ydataai/[email protected] | |
with: | |
ignore_sha: true | |
access_token: ${{ secrets.ACCESS_TOKEN }} | |
prepare: | |
name: Prepare | |
runs-on: ubuntu-22.04 | |
needs: | |
- cancel_previous | |
outputs: | |
build_number: ${{ steps.short_sha.outputs.value }} | |
version: ${{ steps.version.outputs.value }} | |
steps: | |
- name: Version | |
id: version | |
run: echo "value=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
- name: Git Short sha | |
id: short_sha | |
run: echo "value=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
docker: | |
name: Docker Tag and Push | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
strategy: | |
fail-fast: true | |
matrix: | |
package: [metering, quota] | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ env.ECR_ROLE_ARN }} | |
aws-region: ${{ env.PRIVATE_ECR_REGION }} | |
- name: Login to Amazon ECR | |
id: ecr_password | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Docker tag release | |
env: | |
REPOSITORY: ${{ env.DOCKER_REPOSITORY }}/${{ matrix.package }} | |
TAG: ${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.build_number }} | |
NEW_TAG: ${{ needs.prepare.outputs.version }} | |
run: | | |
MANIFEST=$(aws ecr batch-get-image --repository-name $REPOSITORY --image-ids imageTag=$TAG --query 'images[].imageManifest' --output text) | |
aws ecr put-image --repository-name $REPOSITORY --image-tag $NEW_TAG --image-manifest "$MANIFEST" | |
update-manifests: | |
name: Update Manifests | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
- docker | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
package: [metering, quota] | |
steps: | |
- name: Checkout Manifests repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ydataai/manifests | |
token: ${{ secrets.ACCESS_TOKEN }} | |
- uses: imranismail/setup-kustomize@v2 | |
with: | |
kustomize-version: ${{ secrets.KUSTOMIZE_VERSION }} | |
- name: Update kustomization image tag | |
env: | |
CONTAINER_PKG: ${{ matrix.package }}-${{ env.CONTAINER }} | |
DOCKER_IMAGE_TAG: ${{ env.DOCKER_REPOSITORY }}/${{ matrix.package }}:${{ needs.prepare.outputs.version }} | |
VERSION: ${{ needs.prepare.outputs.version }} | |
run: | | |
cd ${COMPONENT_PATH} | |
kustomize edit set image ${CONTAINER_PKG}=${DOCKER_IMAGE_TAG} | |
- name: Commit and push image update into manifests repo | |
env: | |
VERSION: ${{ needs.prepare.outputs.version }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Azory YData Bot" | |
git commit -a -m "chore(bump): [CI] [PROD] bump ${{ env.COMPONENT }} package ${{ matrix.package }} to $VERSION" | |
git push origin master |