diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-dev-container.yaml similarity index 94% rename from .github/workflows/build-container.yaml rename to .github/workflows/build-dev-container.yaml index 7d905cb..1c9ad70 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-dev-container.yaml @@ -1,4 +1,4 @@ -name: Build Docker Image +name: Build Dev Images on: release: @@ -9,8 +9,6 @@ on: push: branches: - main - tags: - - '**' pull_request: {} workflow_dispatch: @@ -48,7 +46,6 @@ jobs: images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" tags: | type=ref,event=branch - type=ref,event=tag type=ref,event=pr type=raw,value=latest-{{date 'YYYYMMDDHHmmss'}}-{{sha}} diff --git a/.github/workflows/release.yaml b/.github/workflows/helm-release.yaml similarity index 86% rename from .github/workflows/release.yaml rename to .github/workflows/helm-release.yaml index 0e90087..92db060 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/helm-release.yaml @@ -1,15 +1,18 @@ -name: Release Helm - on: push: - tags: - - '**' + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: Release jobs: + build-helm-chart: name: Build Helm chart - permissions: - contents: write runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 5fe6d87..300443f 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -7,11 +7,61 @@ permissions: contents: write pull-requests: write -name: release-please +name: Release jobs: release-please: runs-on: ubuntu-latest + outputs: + version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} + released: ${{ steps.release.outputs.releases_created }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: googleapis/release-please-action@v4 + id: release + + + build-container-image: + name: Build container image + runs-on: ubuntu-latest + needs: release-please + if: needs.release-please.outputs.released + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" + tags: | + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=raw,value=latest-{{date 'YYYYMMDDHHmmss'}}-{{sha}} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{needs.release-please.outputs.version}}" + platforms: | + linux/amd64 + linux/arm64 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7335267..b70da8b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,3 @@ { ".": "1.3.0", - "charts/radix-prometheus-proxy": "1.1.0" -} \ No newline at end of file +} diff --git a/README.md b/README.md index 2a9d57e..4ab9224 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,8 @@ Currently this exports uptime statistics using the `probe_success` metric from p ## How we work Commits to the main branch must follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and uses Release Please to create new versions. + +# TODO: + +- Manually patch helm chart based on please-release output +- Manually tag docker image based on please-release output diff --git a/charts/radix-prometheus-proxy/CHANGELOG.md b/charts/radix-prometheus-proxy/CHANGELOG.md deleted file mode 100644 index 0c8963f..0000000 --- a/charts/radix-prometheus-proxy/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# Changelog - -## [1.1.0](https://github.com/equinor/radix-prometheus-proxy/compare/radix-prometheus-proxy-chart-v1.0.0...radix-prometheus-proxy-chart-v1.1.0) (2024-10-11) - - -### Features - -* release helm charts ([#9](https://github.com/equinor/radix-prometheus-proxy/issues/9)) ([8d03462](https://github.com/equinor/radix-prometheus-proxy/commit/8d034621e1dd6cdf2f389c5d74ae0b3a203671cf)) - -## 1.0.0 (2024-10-11) - - -### Features - -* Fix workflow ([#7](https://github.com/equinor/radix-prometheus-proxy/issues/7)) ([d91ffca](https://github.com/equinor/radix-prometheus-proxy/commit/d91ffcab9870e6e7fc33eba8b0156b9afcc39cc5)) diff --git a/release-please-config.json b/release-please-config.json index 6d202b6..9b5eaf6 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,13 +1,15 @@ { "packages": { - "charts/radix-prometheus-proxy": { - "release-type": "helm", - "package-name": "radix-prometheus-proxy-chart" - }, ".": { "changelog-path": "CHANGELOG.md", "initial-version": "0.1.0", - "release-type": "simple" + "release-type": "simple", + "extra-files": [ + { + "type": "yaml", + "path": "charts/radix-prometheus-proxy/Chart.yaml", + "jsonpath": "$.version" + }] } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"