From 112fa9380c284f69323aa349a4261df9870e4120 Mon Sep 17 00:00:00 2001 From: Woomy Date: Wed, 1 Feb 2023 17:57:56 +0100 Subject: [PATCH] ci: Add docker push on release Signed-off-by: Woomymy --- .github/workflows/release.yml | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4c23f7..235bb46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,11 @@ on: push: tags: - '*' - + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: lint: # Excute eslint & prettier @@ -57,3 +61,35 @@ jobs: release_name: Release ${{ steps.tag.outputs.tag }} body_path: 'changelog.txt' draft: false + build-and-push-image: + needs: ['compile', 'lint'] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}