From 05f996d993fd29f7dfb9f8f268d8d1cca365fab2 Mon Sep 17 00:00:00 2001 From: Andrea Giulianelli Date: Mon, 16 Jan 2023 19:02:40 +0100 Subject: [PATCH] ci: add docker image auto delivery --- .github/workflows/build-and-deploy.yml | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index a85cdad..7996365 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -70,14 +70,40 @@ jobs: uses: actions/setup-node@v3 with: node-version: "lts/*" - - name: Generate Documentation - run: ./gradlew dokkaHtml - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | npm install npx semantic-release + docker-image-delivery: + needs: + - release + runs-on: ubuntu-latest + if: needs.release.outputs.release-status == released + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Login to GitHub Container registry + uses: docker/login-action@v2.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: version + run: echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + - name: Build and push the image to GitHub Container registry + uses: docker/build-push-action@3.3.0 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} documentation-deploy: needs: - release @@ -106,6 +132,8 @@ jobs: needs: - build - release + - docker-image-delivery + - documentation-deploy if: >- always() && ( contains(join(needs.*.result, ','), 'failure')