diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 07:47:15 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 07:47:15 +0000 |
| commit | aa472842a579d8195f6ce2c04cf0bb1cf5d3e4d0 (patch) | |
| tree | c0fe2d18d3ea32e5dd71993a14c90f3b9c63a9f9 /.github/workflows/ghcr.yml | |
| parent | d9dfabe75e4edb7fe2f32cb9a42113a529f52bf6 (diff) | |
ci: publish and release
Diffstat (limited to '.github/workflows/ghcr.yml')
| -rw-r--r-- | .github/workflows/ghcr.yml | 54 |
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" |
