diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 09:47:15 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-22 09:47:15 +0200 |
commit | aa472842a579d8195f6ce2c04cf0bb1cf5d3e4d0 (patch) | |
tree | c0fe2d18d3ea32e5dd71993a14c90f3b9c63a9f9 | |
parent | d9dfabe75e4edb7fe2f32cb9a42113a529f52bf6 (diff) |
ci: publish and release
-rw-r--r-- | .github/workflows/ghcr.yml | 54 | ||||
-rw-r--r-- | .github/workflows/release.yml | 37 |
2 files changed, 91 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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d4d8bb6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Create Release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '>=1.18' + + - name: Build Executables + run: make build-api build-ui + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + draft: false + prerelease: false + files: | + rahanna-api + rahanna-ui |