-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ivan Mikheykin <[email protected]>
- Loading branch information
Showing
4 changed files
with
55 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ test | |
|
||
.git | ||
.gitignore | ||
Dockerfile | ||
LICENSE | ||
*.md | ||
*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,13 +24,13 @@ jobs: | |
id: check | ||
with: | ||
script: | | ||
const PUBLISH_DEV_LABEL = 'publish/image/dev'; | ||
const PUBLISH_FULL_LABEL = 'publish/image/dev/full'; | ||
const PUBLISH_AMD64_LABEL = 'publish/image/dev/amd64'; | ||
const labelName = context.payload.label.name; | ||
let runPublish = false; | ||
let buildMultiArch = false; | ||
if (labelName === PUBLISH_DEV_LABEL) { | ||
if (labelName === PUBLISH_FULL_LABEL) { | ||
runPublish = true; | ||
buildMultiArch = true; | ||
} | ||
|
@@ -77,14 +77,16 @@ jobs: | |
: Image name and version for dev image | ||
# Example: dev-feat_branch-371e2d3b-2020.02.06_18:37:42 | ||
APP_VERSION=dev-${GITHUB_REF#refs/heads/}-${GITHUB_SHA::8}-$(date +'%Y.%m.%d_%H:%M:%S') | ||
GHCR_IO_IMAGE_NAME="${GHCR_IO_REPO}:pr${{ github.event.pull_request.number }}" | ||
IMAGE_TAG="pr${{ github.event.pull_request.number }}" | ||
GHCR_IO_IMAGE_NAME="${GHCR_IO_REPO}:${IMAGE_TAG}" | ||
echo "APP_VERSION=${APP_VERSION}" >> ${GITHUB_ENV} | ||
echo "GHCR_IO_IMAGE_NAME=${GHCR_IO_IMAGE_NAME}" >> ${GITHUB_ENV} | ||
echo "=========================================" | ||
echo "APP_VERSION = $APP_VERSION" | ||
echo "GHCR_IO_IMAGE_NAME = $GHCR_IO_IMAGE_NAME" | ||
echo "APP_VERSION = $APP_VERSION" | ||
echo "IMAGE_TAG = $IMAGE_TAG" | ||
echo "GHCR_IO_IMAGE_NAME = $GHCR_IO_IMAGE_NAME" | ||
echo "=========================================" | ||
if [[ ${BUILD_MULTI_ARCH} == "false" ]] ; then | ||
|
@@ -94,17 +96,14 @@ jobs: | |
echo "BUILDX_PLATFORMS = ${BUILDX_PLATFORMS}" | ||
echo "=========================================" | ||
- name: Set up QEMU | ||
- name: Setup qemu | ||
if: needs.check.outputs.build_multi_arch == 'true' | ||
uses: docker/[email protected] | ||
with: | ||
platforms: "${{ env.QEMU_PLATFORMS }}" | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
version: latest | ||
- name: Setup werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Login to Github Container Registry | ||
uses: docker/[email protected] | ||
|
@@ -113,14 +112,19 @@ jobs: | |
username: ${{ secrets.GHCR_IO_USER }} | ||
password: ${{ secrets.GHCR_IO_PASS }} | ||
|
||
- name: Build and push using buildx | ||
- name: Build and push | ||
run: | | ||
echo "Build ${GHCR_IO_IMAGE_NAME} with version '${APP_VERSION}'" | ||
docker buildx build \ | ||
--platform $BUILDX_PLATFORMS \ | ||
--build-arg appVersion=$APP_VERSION \ | ||
--tag $GHCR_IO_IMAGE_NAME \ | ||
--push . | ||
echo "Build ${GHCR_IO_IMAGE_NAME} with version '${APP_VERSION}' and tag '${IMAGE_TAG}'" | ||
source "$(werf ci-env github --as-file)" | ||
werf build --repo ${GHCR_IO_REPO} --add-custom-tag '${IMAGE_TAG}' | ||
# docker buildx build \ | ||
# --platform $BUILDX_PLATFORMS \ | ||
# --build-arg appVersion=$APP_VERSION \ | ||
# --tag $GHCR_IO_IMAGE_NAME \ | ||
# --push . | ||
|
||
- name: Inspect binaries | ||
if: needs.check.outputs.build_multi_arch == 'true' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
project: shell-operator | ||
configVersion: 1 | ||
build: | ||
platforms: | ||
- linux/amd64 | ||
- linux/arm64 | ||
--- | ||
image: main | ||
dockerfile: Dockerfile | ||
staged: true | ||
args: | ||
appVersion: {{ env "APP_VERSION" }} |