|
7 | 7 | - main
|
8 | 8 |
|
9 | 9 | permissions:
|
10 |
| - contents: write |
11 |
| - pull-requests: write |
| 10 | + contents: read |
12 | 11 |
|
13 | 12 | jobs:
|
14 | 13 | release-please:
|
15 | 14 | runs-on: ubuntu-latest
|
16 |
| - if: "${{ github.repository_owner == 'weaveworks' && github.ref_name == 'main'}}" |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + pull-requests: write |
| 18 | + if: "${{ github.repository_owner == 'weaveworks' && github.ref_name == 'main' }}" |
17 | 19 | steps:
|
18 |
| - - id: release |
| 20 | + - id: Release Please |
19 | 21 | uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
|
20 | 22 | with:
|
21 | 23 | token: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}
|
| 24 | + |
| 25 | + publish-npm-package: |
| 26 | + needs: release-please |
| 27 | + runs-on: ubuntu-latest |
| 28 | + permissions: |
| 29 | + packages: write # needed for GitHub Packages registry access |
| 30 | + if: "${{ needs.release-please.outputs.outputs.release_created }}" |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 34 | + - name: Setup Node.js |
| 35 | + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 |
| 36 | + with: |
| 37 | + node-version-file: package.json |
| 38 | + registry-url: "https://npm.pkg.github.com" |
| 39 | + scope: "@weaveworks" |
| 40 | + - run: yarn |
| 41 | + - run: make ui-lib && cd dist && npm publish |
| 42 | + env: |
| 43 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + build-and-push-image: |
| 46 | + needs: release-please |
| 47 | + uses: ./.github/workflows/build-push-image.yaml |
| 48 | + with: |
| 49 | + file: gitops-server.dockerfile |
| 50 | + flavor: | |
| 51 | + latest=true |
| 52 | + image: ghcr.io/weaveworks/wego-app |
| 53 | + platforms: linux/amd64,linux/arm64 |
| 54 | + push: true |
| 55 | + tags: | |
| 56 | + type=raw,value=${{ needs.release-please.outputs.outputs.tag_name }} |
| 57 | + type=semver,pattern={{version}},value=${{ needs.release-please.outputs.outputs.version }} |
| 58 | + permissions: |
| 59 | + contents: read # for actions/checkout to fetch code |
| 60 | + id-token: write # for Cosign to be able to sign images with GHA token |
| 61 | + packages: write # for docker/build-push-action to push images |
| 62 | + if: "${{ needs.release-please.outputs.outputs.release_created }}" |
| 63 | + |
| 64 | + goreleaser: |
| 65 | + needs: release-please |
| 66 | + runs-on: ubuntu-latest |
| 67 | + permissions: |
| 68 | + contents: read # for actions/checkout to fetch code |
| 69 | + id-token: write # for Cosign to be able to sign release artifacts with GHA token |
| 70 | + if: "${{ needs.release-please.outputs.outputs.release_created }}" |
| 71 | + steps: |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 74 | + with: |
| 75 | + fetch-depth: 0 |
| 76 | + - name: Setup Go |
| 77 | + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
| 78 | + with: |
| 79 | + go-version-file: go.mod |
| 80 | + - name: Include brew publishing |
| 81 | + run: cat .goreleaser.brew.yml >> .goreleaser.yml |
| 82 | + if: ${{ !contains(needs.release-please.outputs.outputs.version, '-') }} |
| 83 | + - name: Install cosign |
| 84 | + uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1 |
| 85 | + - name: Run GoReleaser |
| 86 | + uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 |
| 87 | + with: |
| 88 | + version: latest |
| 89 | + args: release --clean |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }} |
| 92 | + BOT_TOKEN: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }} |
0 commit comments