From 9cd5efb1d76b6acc145e9a4d18f92e02a2a81320 Mon Sep 17 00:00:00 2001 From: emrah Date: Wed, 20 Nov 2024 17:37:46 +0300 Subject: [PATCH] chore(docker): add a workflow to create the image --- .github/workflows/docker-images.yml | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/docker-images.yml diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml new file mode 100644 index 0000000..e4df881 --- /dev/null +++ b/.github/workflows/docker-images.yml @@ -0,0 +1,56 @@ +name: jitsi-keycloak-adapter-v2 + +on: + push: + branches: + - "main" + paths: + - ".github/**" + - "Dockerfile" + - "src/**.ts" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Custom metadata + run: | + echo "BUILD_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV + echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Metadata + uses: docker/metadata-action@v5 + id: meta + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest + type=raw,value=v${{ env.BUILD_DATE }} + + - name: Login + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}