diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..49db811 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build +on: + push: + branches: + - master + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to ECR + uses: docker/login-action@v3 + with: + registry: ${{ vars.AWS_ECR_MASTER_ACCOUNT }}.dkr.ecr.${{ vars.AWS_ECR_MASTER_REGION }}.amazonaws.com + username: ${{ secrets.AWS_ECR_MASTER_ACCESS_KEY }} + password: ${{ secrets.AWS_ECR_MASTER_SECRET_ACCESS_KEY }} + + - name: build + run: | + make -f Makefile build push BRANCH=${{ github.ref_name }} NPM_TOKEN=${{ secrets.NPM_TOKEN }} ECR_ACCOUNT=${{ vars.AWS_ECR_MASTER_ACCOUNT }} ECR_REGION=${{ vars.AWS_ECR_MASTER_REGION }} + make -f Makefile git-prep git-push GH_TOKEN=${{ secrets.GH_ADMIN_TOKEN }} BRANCH=${{ github.ref_name }} diff --git a/Jenkinsfile b/Jenkinsfile.disable similarity index 100% rename from Jenkinsfile rename to Jenkinsfile.disable diff --git a/Makefile b/Makefile index 0901a64..9d2edcb 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ IMAGE_REPO = teamwork/$(NAME) CACHE_TAG = $(IMAGE_REPO):cache-$(BRANCH) TAG = $(IMAGE_REPO):$(VERSION) +ECR_IMAGE_REPO = $(ECR_ACCOUNT).dkr.ecr.$(ECR_REGION).amazonaws.com/teamwork/$(NAME) +ECR_CACHE_TAG = $(ECR_IMAGE_REPO):cache-$(BRANCH) +ECR_TAG = $(ECR_IMAGE_REPO):$(VERSION) + .PHONY: default install build push chart-update git-prep git-push install-docker install-buildx install-yq # @@ -26,6 +30,7 @@ build: --build-arg BUILD_VCS_REF=$(shell git rev-parse --short HEAD) \ --build-arg BUILD_VERSION=$(VERSION) \ -t $(TAG) \ + -t $(ECR_TAG) \ --load \ . @@ -37,6 +42,7 @@ push: --cache-from=type=registry,ref=$(CACHE_TAG) \ --cache-to=type=registry,ref=$(CACHE_TAG),mode=max \ -t $(TAG) \ + -t $(ECR_TAG) \ --push \ --progress=plain \ . @@ -45,8 +51,8 @@ push: # Helm chart updates # chart-update: - yq w -i docker/helm/Chart.yaml appVersion $(VERSION) - yq w -i docker/helm-eks/Chart.yaml appVersion $(VERSION) + yq eval -i '.appVersion = "$(VERSION)"' docker/helm/Chart.yaml + yq eval -i '.appVersion = "$(VERSION)"' docker/helm-eks/Chart.yaml # # GitOps deployment will be triggered by a committed change to helm chart