From aa472842a579d8195f6ce2c04cf0bb1cf5d3e4d0 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 22 Apr 2025 09:47:15 +0200 Subject: ci: publish and release --- .github/workflows/ghcr.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/ghcr.yml (limited to '.github/workflows/ghcr.yml') 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" -- cgit v1.2.3-18-g5258