Skip to content

Commit

Permalink
Test manager build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGodbehere committed Mar 22, 2024
1 parent 88d20c1 commit 0744c1d
Showing 1 changed file with 138 additions and 30 deletions.
168 changes: 138 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,45 +204,153 @@ jobs:
# version: ${{ steps.prepare.outputs.version }}
# service-name: ${{ steps.prepare.outputs.service-name }}
# digest: ${{ steps.build-and-push.outputs.digest }}
# build-manager:
# runs-on: ubuntu-latest
# steps:
# - name: Skip
# run: |
# echo "Skipping"
# build-mqtt:
# runs-on: ubuntu-latest
# steps:
# - name: Skip
# run: |
# echo "Skipping"
build-helm-chart:
# needs: [ 'build-x86', 'build-x86-arm', 'build-manager', 'build-mqtt' ]
build-manager:
name: Build Manager
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
pull-requests: write
steps:
- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Checkout code
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/prepare
id: prepare
with:
service-name: acs-manager
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check Backend Builder
id: check-backend-builder
run: |
docker manifest inspect ghcr.io/amrc-factoryplus/acs-manager:backend-build-1.1.0 || echo "needs-build=true" >> $GITHUB_OUTPUT
- name: Build Backend Builder
id: build-backend-builder
if: steps.check-backend-builder.outputs.needs-build == 'true'
uses: docker/build-push-action@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
context: acs-manager
file: ./.docker/Dockerfiles/Dockerfile.backend-build
push: true
tags: ghcr.io/amrc-factoryplus/acs-manager:backend-build-1.1.0

- name: Check Backend Base
id: check-backend-base
run: |
docker manifest inspect ghcr.io/amrc-factoryplus/acs-manager:prod-base-php82-1.0.6 || echo "needs-build=true" >> $GITHUB_OUTPUT
- name: Build Backend Base
id: build-backend-base
if: steps.check-backend-base.outputs.needs-build == 'true'
uses: docker/build-push-action@v4
with:
context: acs-manager
file: ./.docker/Dockerfiles/Dockerfile.backend-base
push: true
tags: ghcr.io/amrc-factoryplus/acs-manager:prod-base-php82-1.0.6

- name: Build Backend
id: build-backend
uses: docker/build-push-action@v4
with:
context: acs-manager
file: ./.docker/Dockerfiles/Dockerfile
load: true
tags: ${{ steps.prepare.outputs.version }}-backend
labels: ${{ steps.prepare.outputs.labels }}
outputs: type=docker,dest=/tmp/image.tar

- name: Upload Backend
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.number }}
path: /tmp/image.tar

- name: Build & Push Frontend
id: build-and-push-frontend
uses: docker/build-push-action@v4
with:
context: acs-manager
push: true
file: ./.docker/Dockerfiles/Dockerfile
target: production-frontend
tags: ${{ steps.prepare.outputs.version }}-frontend
labels: ${{ steps.prepare.outputs.labels }}

push-manager:
name: Push Backend
runs-on: ubuntu-latest
needs: build-manager
permissions:
contents: read
packages: write
id-token: write
pull-requests: write

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package Helm chart
run: |
TAG=${{ github.event.release.tag_name }}
VERSION=${TAG#v}
helm package -u -d deploy/build --version=$VERSION --app-version=$VERSION deploy
echo "VERSION=$VERSION" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/amrc-factoryplus/acs-manager

- name: Download artifact
uses: actions/download-artifact@v2
with:
name: new-release
path: build/amrc-connectivity-stack-${{ env.VERSION }}.tgz
name: ${{ github.event.number }}
path: /tmp

- name: Load and push image
run: |
docker load --input /tmp/image.tar
docker image ls -a
docker push ${{ steps.prepare.outputs.version }}-backend
build-mqtt:
runs-on: ubuntu-latest
steps:
- name: Skip
run: |
echo "Skipping"
# build-helm-chart:
# needs: [ 'build-x86', 'build-x86-arm', 'push-manager', 'build-mqtt' ]
# runs-on: ubuntu-latest
# steps:
# - name: Install Helm
# run: |
# curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# ref: ${{ github.event.release.tag_name }}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Package Helm chart
# run: |
# TAG=${{ github.event.release.tag_name }}
# VERSION=${TAG#v}
# helm package -u -d deploy/build --version=$VERSION --app-version=$VERSION deploy
# echo "VERSION=$VERSION" >> $GITHUB_ENV
# - uses: actions/upload-artifact@v3
# with:
# name: new-release
# path: build/amrc-connectivity-stack-${{ env.VERSION }}.tgz

# This job checks out the release branch, adds the new release to the /builds folder, builds the index and commits
# the changes, which triggers Github to release it as a new pages repo
Expand Down

0 comments on commit 0744c1d

Please sign in to comment.