Skip to content

Commit

Permalink
Change
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Mar 7, 2025
1 parent bb328fb commit 5b242f0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 41 deletions.
55 changes: 43 additions & 12 deletions .github/workflows/arch.yaml → .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name: Arch Test
name: Publish Artifacts

on:
workflow_dispatch:
workflow_call:
inputs:
version:
type: string
default: "-"

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
docker:
name: Docker E2E Tests
build:
name: Build Images
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -22,6 +25,8 @@ jobs:
arch: arm64
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: "Setup Docker"
uses: ./.github/actions/setup-docker
- name: "Setup Env"
Expand All @@ -38,23 +43,32 @@ jobs:
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Test

- name: Build
shell: devenv shell bash -- -e {0}
env:
TAG_NAME: ${{ inputs.version }}
TARGET_ARCH: ${{ matrix.arch }}
AWS_ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }}
run: |
# Build first to prevent partial container set push
yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:arch4-${TARGET_ARCH}
export IMAGE_TAG=${TAG_NAME#v}
# Build first to prevent partial container set push
yarn nx run-many -t container --push true --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:arch4-${TARGET_ARCH}
yarn nx run-many -t container --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG}-${TARGET_ARCH}
yarn nx container load-generator --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-utils:load-gen.${IMAGE_TAG}
# Then push
yarn nx run-many -t container --push true --projects=tag:service --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName}:${IMAGE_TAG}-${TARGET_ARCH}
yarn nx container load-generator --push true --tags ${AWS_ECR_REPOSITORY}/retail-store-sample-utils:load-gen.${IMAGE_TAG}
manifest:
needs: docker
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: "Setup Env"
uses: ./.github/actions/setup-env
- name: "Get AWS credentials"
Expand All @@ -72,5 +86,22 @@ jobs:

- name: Push manifests
shell: devenv shell bash -- -e {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ inputs.version }}
AWS_ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }}
run: |
yarn nx run-many -t manifest --projects=tag:service --args="--repository=public.ecr.aws/t0t9x2q2/retail-store-sample-{projectName},--tag=arch4"
export IMAGE_TAG=${TAG_NAME#v}
yarn nx run-many -t manifest --projects=tag:service --args="--repository=${AWS_ECR_REPOSITORY}/retail-store-sample-{projectName},--tag=${IMAGE_TAG}"
yarn nx manifest load-generator --args="--repository=${AWS_ECR_REPOSITORY}/retail-store-sample-utils,--tag=load-gen.${IMAGE_TAG}"
yarn nx run-many -t helm --projects=tag:service --remote oci://${AWS_ECR_REPOSITORY} --push
bash scripts/compose-dist.sh
gh release upload ${TAG_NAME} ./dist/docker-compose/docker-compose.yaml --clobber
bash scripts/kubernetes-dist.sh
gh release upload ${TAG_NAME} ./dist/kubernetes/kubernetes.yaml --clobber
36 changes: 7 additions & 29 deletions .github/workflows/publish-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,17 @@ name: Publish Artifacts
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
version:
description: "Version"
required: true

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: "Get AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
role-session-name: GithubActionsSession

- name: "Login to Amazon ECR Public"
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}

- name: "Publish artifacts"
uses: ./.github/actions/publish-artifacts
with:
tag: ${{ inputs.tag }}
ecr-repository: ${{ secrets.AWS_ECR_REPOSITORY }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
artifacts:
uses: ./.github/workflows/artifacts.yaml
with:
version: ${{ inputs.version }}
secrets: inherit

0 comments on commit 5b242f0

Please sign in to comment.