chore(release): prepare for stable release 1.13.0 (#59) #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and deploy Docker and Helm | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' # semver stable | |
| - 'v[0-9]+.[0-9]+.[0-9]+-*' # semver with prerelease suffix | |
| jobs: | |
| metadata: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| version: ${{ steps.metadata.outputs.version }} | |
| release-exist: ${{ steps.metadata.outputs.release_exist }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Metadata | |
| id: metadata | |
| env: | |
| tag: ${{ github.ref_name }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -Eeuo pipefail | |
| version=${tag#v} | |
| release_exist="true" | |
| if ! gh release view v${version} 1> /dev/null ; then | |
| release_exist="false" | |
| fi | |
| echo "version="$version"" >>"$GITHUB_OUTPUT" | |
| echo "release_exist="$release_exist"" >>"$GITHUB_OUTPUT" | |
| deploy-docker: | |
| runs-on: ubuntu-latest | |
| needs: metadata | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| CONTAINER_REGISTRY: ghcr.io | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.CONTAINER_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Container metadata | |
| id: container-metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: "${{ env.CONTAINER_REGISTRY }}/equinor/radix/prometheus-proxy" | |
| tags: ${{ needs.metadata.outputs.version }} | |
| - name: Build and push container images | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: | | |
| linux/amd64 | |
| linux/arm64 | |
| tags: ${{ steps.container-metadata.outputs.tags }} | |
| labels: ${{ steps.container-metadata.outputs.labels }} | |
| deploy-helm: | |
| runs-on: ubuntu-latest | |
| needs: metadata | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| HELM_CHART_REGISTRY: oci://ghcr.io | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.18.3 | |
| - name: Helm login | |
| run: | | |
| set -Eeuo pipefail | |
| helm registry login ${{env.HELM_CHART_REGISTRY }} \ | |
| --username ${{ github.actor }} \ | |
| --password ${{ secrets.GITHUB_TOKEN }} | |
| - name: Helm package and push | |
| id: deploy-helm | |
| working-directory: charts/radix-prometheus-proxy | |
| run: | | |
| set -Eeuo pipefail | |
| version=${{ needs.metadata.outputs.version }} | |
| helm_repo=${{ env.HELM_CHART_REGISTRY }}/equinor/radix/charts | |
| helm package --version $version --app-version $version . | |
| helm push radix-prometheus-proxy-$version.tgz $helm_repo | |
| # Use glob to get list of generated packages | |
| helm_packages=$(ls *.tgz) | |
| echo "helm_packages=$helm_packages" >>"$GITHUB_OUTPUT" | |
| - name: Upload Helm packages to release | |
| if: needs.metadata.outputs.release-exist == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| working-directory: charts/radix-prometheus-proxy | |
| run: | | |
| set -Eeuo pipefail | |
| gh release upload --clobber "v${{ needs.metadata.outputs.version }}" ${{ steps.deploy-helm.outputs.helm_packages }} | |