Skip to content

Commit

Permalink
update pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Frapschen committed Aug 28, 2023
1 parent b4c830f commit c48d768
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 20 deletions.
77 changes: 67 additions & 10 deletions .github/workflows/dev-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'daocloud'

jobs:
build_and_push_images:
build_and_push_images_v2:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -25,24 +25,84 @@ jobs:
strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/adservice-v2/Dockerfile
tag_suffix: adservice-v2
context: ./
- file: ./src/dataservice/Dockerfile
tag_suffix: dataservice
context: ./
- file: ./src/checkoutservice-v2/Dockerfile
tag_suffix: checkoutservice-v2
context: ./
- file: ./src/spring-cloud-gateway/Dockerfile
tag_suffix: spring-cloud-gateway
context: ./

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.ACTIONS_TOKEN }}
if: github.event_name != 'pull_request'

# - name: Log in to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# if: github.event_name != 'pull_request'

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Matrix Build and push demo images
uses: docker/build-push-action@v3.2.0
with:
context: ${{ matrix.file_tag.context }}
file: ${{ matrix.file_tag.file }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_REPO }}:${{ github.sha }}-${{ matrix.file_tag.tag_suffix }}
${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{ matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
DOCKERHUB_REPO: "openinsight-proj/demo"
GHCR_REPO: "ghcr.io/openinsight-proj/demo"

strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
- file: ./src/checkoutservice-v2/Dockerfile
tag_suffix: checkoutservice-v2
context: ./
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
Expand Down Expand Up @@ -91,9 +151,6 @@ jobs:
- file: ./test/Dockerfile
tag_suffix: integrationTests
context: ./
- file: ./src/spring-cloud-gateway/Dockerfile
tag_suffix: spring-cloud-gateway
context: ./

steps:
- uses: actions/checkout@v3
Expand Down
76 changes: 66 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [published]

jobs:
build_and_push_images:
build_and_push_images_v2:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -21,24 +21,83 @@ jobs:
strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/adservice-v2/Dockerfile
tag_suffix: adservice-v2
context: ./
- file: ./src/dataservice/Dockerfile
tag_suffix: dataservice
context: ./
- file: ./src/checkoutservice-v2/Dockerfile
tag_suffix: checkoutservice-v2
context: ./
- file: ./src/spring-cloud-gateway/Dockerfile
tag_suffix: spring-cloud-gateway
context: ./

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.ACTIONS_TOKEN }}
if: github.event_name != 'pull_request'

# - name: Log in to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# if: github.event_name != 'pull_request'

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Matrix Build and push demo images
uses: docker/build-push-action@v3.3.0
with:
context: ${{ matrix.file_tag.context }}
file: ${{ matrix.file_tag.file }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{ matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
DOCKERHUB_REPO: "openinsight-proj/demo"
GHCR_REPO: "ghcr.io/openinsight-proj/demo"

strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
- file: ./src/checkoutservice-v2/Dockerfile
tag_suffix: checkoutservice-v2
context: ./
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
Expand Down Expand Up @@ -87,9 +146,6 @@ jobs:
- file: ./test/Dockerfile
tag_suffix: integrationTests
context: ./
- file: ./src/spring-cloud-gateway/Dockerfile
tag_suffix: spring-cloud-gateway
context: ./

steps:
- uses: actions/checkout@v3
Expand Down

0 comments on commit c48d768

Please sign in to comment.