Skip to content

Commit

Permalink
Multi-arch
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Feb 20, 2025
1 parent e67727b commit 608c716
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 104 deletions.
7 changes: 5 additions & 2 deletions .github/actions/publish-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
115 changes: 13 additions & 102 deletions .github/workflows/publish-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Release
name: Publish Artifacts

on:
workflow_dispatch:
Expand All @@ -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/[email protected]

- 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 }}

0 comments on commit 608c716

Please sign in to comment.