From 608c716e306b39bf2fd73a0fb136fe1653c57d1d Mon Sep 17 00:00:00 2001 From: Niall Thomson Date: Thu, 20 Feb 2025 04:13:56 +0000 Subject: [PATCH] Multi-arch --- .github/actions/publish-artifacts/action.yml | 7 +- .github/workflows/publish-build.yml | 115 +++---------------- 2 files changed, 18 insertions(+), 104 deletions(-) diff --git a/.github/actions/publish-artifacts/action.yml b/.github/actions/publish-artifacts/action.yml index 5c55b6ce6..3da9affa1 100644 --- a/.github/actions/publish-artifacts/action.yml +++ b/.github/actions/publish-artifacts/action.yml @@ -13,6 +13,9 @@ inputs: runs: using: "composite" steps: + - name: "Setup Docker" + uses: ./.github/actions/setup-docker + - name: "Setup Env" uses: ./.github/actions/setup-env @@ -28,10 +31,10 @@ runs: yarn nx run-many -t build --projects=tag:service --parallel=1 # Ensure all containers build - yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG} --push true + yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG} --configuration publish --push false # Then push - yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG} + yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG} --configuration publish yarn nx run-many -t helm --projects=tag:service --remote oci://${AWS_ECR_REPOSITORY} --push diff --git a/.github/workflows/publish-build.yml b/.github/workflows/publish-build.yml index da92af341..6520c7dcb 100644 --- a/.github/workflows/publish-build.yml +++ b/.github/workflows/publish-build.yml @@ -1,4 +1,4 @@ -name: Publish Release +name: Publish Artifacts on: workflow_dispatch: @@ -13,118 +13,29 @@ permissions: pull-requests: write jobs: - tag: - name: Tag + Branch + publish: runs-on: ubuntu-latest - - steps: - - name: Check out code - uses: actions/checkout@v3 - - - uses: azure/setup-kubectl@v3 - id: install - - - name: Setup helmfile - uses: mamezou-tech/setup-helmfile@v1.3.0 - - - name: Update manifests - env: - TAG: "${{ github.event.inputs.tag }}" - run: | - sudo apt-get install -y gettext - - bash scripts/patch-image-tag.sh - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "Release ${{ github.event.inputs.tag }}" - tagging_message: "${{ github.event.inputs.tag }}" - branch: "release/${{ github.event.inputs.tag }}" - create_branch: true - - images: - name: Build Images - needs: tag - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - with: - ref: ${{ github.event.inputs.tag }} - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v2 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - name: Build Images - env: - TAG: "${{ github.event.inputs.tag }}" - run: | - # Build first to ensure all images create successfully - scripts/build-image.sh -r 'public.ecr.aws/aws-containers' -t $TAG --multi-arch - - - name: Get AWS credentials + - name: "Get AWS credentials" uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: ${{ secrets.AWS_REGION }} + aws-region: us-east-1 role-session-name: GithubActionsSession - - name: Login to Amazon ECR Public + - name: "Login to Amazon ECR Public" id: login-ecr-public - uses: aws-actions/amazon-ecr-login@v1 + uses: aws-actions/amazon-ecr-login@v2 with: registry-type: public - - name: Push Images - env: - TAG: "${{ github.event.inputs.tag }}" - run: | - # Push all images - scripts/build-image.sh -r 'public.ecr.aws/aws-containers' -t $TAG --multi-arch -p - - - name: Push Helm Charts - env: - TAG: "${{ github.event.inputs.tag }}" - run: | - # Push all charts - bash scripts/helm_push.sh -r 'public.ecr.aws/aws-containers' - - release: - name: Release - needs: [tag, images] - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.inputs.tag }} - - - name: Merge to main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr create -B main -H release/${{ github.event.inputs.tag }} --title 'chore(release): ${{ github.event.inputs.tag }}' --body 'Generate pull request for release' - - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v3 + - uses: actions/checkout@v4 with: - configuration: "release-notes-configuration.json" - toTag: ${{ github.event.inputs.tag }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ inputs.tag }} - - name: Create GitHub release - uses: ncipollo/release-action@v1 + - name: "Publish artifacts" + uses: ./.github/actions/publish-artifacts with: - tag: ${{ github.event.inputs.tag }} - name: Release ${{ github.event.inputs.tag }} - body: ${{steps.github_release.outputs.changelog}} + tag: ${{ inputs.tag }} + ecr-repository: ${{ secrets.AWS_ECR_REPOSITORY }} + gh-token: ${{ secrets.GITHUB_TOKEN }}