summaryrefslogtreecommitdiff
path: root/.github/workflows/ghcr.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/ghcr.yml')
-rw-r--r--.github/workflows/ghcr.yml54
1 files changed, 54 insertions, 0 deletions
diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml
new file mode 100644
index 0000000..45522c4
--- /dev/null
+++ b/.github/workflows/ghcr.yml
@@ -0,0 +1,54 @@
+name: Publish Docker Images to GHCR
+
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v3
+ with:
+ push: true
+
+ - name: Login to GHCR
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Extract Version from Tag
+ id: extract_version
+ run: |
+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
+
+ - name: Build and Push Docker Images
+ run: |
+ VERSION=${{ steps.extract_version.outputs.VERSION }}
+ API_IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rahanna-api
+ UI_IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rahanna-ui
+
+ make docker-api
+ docker tag rahanna-api:latest "$API_IMAGE_NAME:latest"
+ docker push "$API_IMAGE_NAME:latest"
+ docker tag rahanna-api:latest "$API_IMAGE_NAME:$VERSION"
+ docker push "$API_IMAGE_NAME:$VERSION"
+
+ make docker-ui
+ docker tag rahanna-ui:latest "$UI_IMAGE_NAME:latest"
+ docker push "$UI_IMAGE_NAME:latest"
+ docker tag rahanna-ui:latest "$UI_IMAGE_NAME:$VERSION"
+ docker push "$UI_IMAGE_NAME:$VERSION"