ci(release): configure Helm chart release (#4867) #50
This file contains 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: release-please | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
if: "${{ github.repository_owner == 'weaveworks' && github.ref_name == 'main' }}" | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} | |
version: ${{ steps.release-please.outputs.version }} | |
steps: | |
- name: Release Please | |
id: release-please | |
uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0 | |
with: | |
token: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }} | |
publish-npm-package: | |
needs: release-please | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write # needed for GitHub Packages registry access | |
if: "${{ needs.release-please.outputs.release_created }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Node.js | |
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
with: | |
node-version-file: package.json | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@weaveworks" | |
- run: yarn | |
- run: make ui-lib && cd dist && npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-and-push-image: | |
needs: release-please | |
uses: ./.github/workflows/build-push-image.yaml | |
with: | |
file: gitops-server.dockerfile | |
flavor: | | |
latest=true | |
image: ghcr.io/weaveworks/wego-app | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
type=raw,value=${{ needs.release-please.outputs.tag_name }} | |
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.version }} | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
id-token: write # for Cosign to be able to sign images with GHA token | |
packages: write # for docker/build-push-action to push images | |
if: "${{ needs.release-please.outputs.release_created }}" | |
goreleaser: | |
needs: release-please | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
id-token: write # for Cosign to be able to sign release artifacts with GHA token | |
if: "${{ needs.release-please.outputs.release_created }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 | |
with: | |
go-version-file: go.mod | |
- name: Include brew publishing | |
run: cat .goreleaser.brew.yml >> .goreleaser.yml | |
if: ${{ !contains(needs.release-please.outputs.version, '-') }} | |
- name: Install cosign | |
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }} | |
BOT_TOKEN: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }} |