From 4a4a5826a50ac3be212f4e813e221ddf461628bd Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Thu, 26 Sep 2024 18:20:02 +0200 Subject: [PATCH] updated github workflows added github action to build a docker image when publishing a new release --- .github/workflows/docker-image.yaml | 31 +++++++++++++++++++++++++++++ .github/workflows/tests.yaml | 2 +- .github/workflows/upgrader.yaml | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-image.yaml diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml new file mode 100644 index 0000000..63d7f94 --- /dev/null +++ b/.github/workflows/docker-image.yaml @@ -0,0 +1,31 @@ +name: Build and publish new docker image + +on: + push: + tags: + - "v*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Login to docker hub + if: success() + uses: actions-hub/docker/login@master + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_REGISTRY_URL: ghcr.io + + - name: Build image + if: success() + run: docker build -t ghcr.io/${GITHUB_REPOSITORY}/cli:${IMAGE_TAG} . + + - name: Push to docker registry + if: success() + uses: actions-hub/docker/cli@master + with: + args: push ghcr.io/${GITHUB_REPOSITORY}/cli:${IMAGE_TAG} \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5adb801..f0e182f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -6,7 +6,7 @@ jobs: kustomize: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | echo 'configMapGenerator: - name: example diff --git a/.github/workflows/upgrader.yaml b/.github/workflows/upgrader.yaml index 5a0dcbd..6fbd017 100644 --- a/.github/workflows/upgrader.yaml +++ b/.github/workflows/upgrader.yaml @@ -88,4 +88,4 @@ jobs: tag_name: ${{ steps.modify.outputs.tag }} release_name: ${{ steps.modify.outputs.tag }} draft: false - prerelease: false + prerelease: false \ No newline at end of file