ac1afc27f2a58be1d418533a4ce651d987a1a1cd

Author
Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix: use config from meta (#57)

* fix: use goreleaser pro on nightly builds

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: dist

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: skip sbom

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: reuse

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: workflows

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: workflows

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: workflows

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: workflows

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: perms

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: workflows

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
  2index 9a9af25f43b89b7b49b1437f12cbb97538c7621e..ca61004fd39a38cd7a0716c6bfcb25a90ea6abe3 100644
  3--- a/.github/workflows/build.yml
  4+++ b/.github/workflows/build.yml
  5@@ -2,9 +2,6 @@ name: build
  6 
  7 on: [push, pull_request]
  8 
  9-permissions:
 10-  packages: write
 11-
 12 jobs:
 13   build:
 14     strategy:
 15@@ -33,119 +30,8 @@ jobs:
 16         run: go test ./...
 17 
 18   nightly:
 19-    env:
 20-      GO111MODULE: "on"
 21-      DOCKER_CLI_EXPERIMENTAL: enabled
 22-    runs-on: ubuntu-latest
 23-    steps:
 24-      - name: Install Go
 25-        uses: actions/setup-go@v2
 26-        with:
 27-          go-version: "~1.17"
 28-
 29-      - name: Checkout code
 30-        uses: actions/checkout@v2
 31-
 32-      - name: Login to GitHub Container Registry
 33-        uses: docker/login-action@v1
 34-        with:
 35-          registry: ghcr.io
 36-          username: ${{ github.repository_owner }}
 37-          password: ${{ secrets.GITHUB_TOKEN }}
 38-
 39-      - name: Set up QEMU
 40-        uses: docker/setup-qemu-action@v1
 41-
 42-      - name: Set up Docker Buildx
 43-        id: buildx
 44-        uses: docker/setup-buildx-action@v1
 45-
 46-      - name: Run GoReleaser
 47-        uses: goreleaser/goreleaser-action@v2
 48-        with:
 49-          distribution: goreleaser
 50-          version: latest
 51-          args: release --snapshot --rm-dist --skip-sign --skip-sbom
 52-        env:
 53-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 54-          HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
 55-
 56-      - name: Push docker images
 57-        run: |
 58-          GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
 59-
 60-          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-amd64 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64
 61-          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-arm64 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64
 62-          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-armv7 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7
 63-          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-i386 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
 64-
 65-          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64
 66-          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64
 67-          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7
 68-          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
 69-
 70-          docker manifest create ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH \
 71-            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64 \
 72-            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64 \
 73-            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7 \
 74-            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
 75-          docker manifest push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH
 76-
 77-          if [[ $GITHUB_REF = 'refs/heads/main' && $GITHUB_EVENT_NAME = 'push' ]]; then
 78-            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-amd64 ghcr.io/$GITHUB_REPOSITORY:devel-amd64
 79-            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-arm64 ghcr.io/$GITHUB_REPOSITORY:devel-arm64
 80-            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-armv7 ghcr.io/$GITHUB_REPOSITORY:devel-armv7
 81-            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-i386 ghcr.io/$GITHUB_REPOSITORY:devel-i386
 82-
 83-            docker push ghcr.io/$GITHUB_REPOSITORY:devel-amd64
 84-            docker push ghcr.io/$GITHUB_REPOSITORY:devel-arm64
 85-            docker push ghcr.io/$GITHUB_REPOSITORY:devel-armv7
 86-            docker push ghcr.io/$GITHUB_REPOSITORY:devel-i386
 87-
 88-            docker manifest create ghcr.io/$GITHUB_REPOSITORY:devel \
 89-              ghcr.io/$GITHUB_REPOSITORY:devel-amd64 \
 90-              ghcr.io/$GITHUB_REPOSITORY:devel-arm64 \
 91-              ghcr.io/$GITHUB_REPOSITORY:devel-armv7 \
 92-              ghcr.io/$GITHUB_REPOSITORY:devel-i386
 93-            docker manifest push ghcr.io/$GITHUB_REPOSITORY:devel
 94-          fi
 95-
 96-      - uses: actions/upload-artifact@v2
 97-        with:
 98-          name: Linux (x86_64)
 99-          path: |
100-            dist/soft-serve_linux_amd64/*
101-            LICENSE
102-            README.md
103-
104-      - uses: actions/upload-artifact@v2
105diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml
106index 76155d5842cfdccda3e38903edd5cae101718bcf..55b36628fc9d87959d852e961ee8ef8a21ceaeb0 100644
107--- a/.github/workflows/goreleaser.yml
108+++ b/.github/workflows/goreleaser.yml
109@@ -12,9 +12,8 @@ concurrency:
110 jobs:
111   goreleaser:
112     uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main
113-    with:
114-      secrets:
115-        docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
116-        docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
117-        gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
118-        goreleaser_key: ${{ secrets.GORELEASER_KEY }}
119+    secrets:
120+      docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
121+      docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
122+      gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
123+      goreleaser_key: ${{ secrets.GORELEASER_KEY }}
124diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml
125index dd30e6c78d40f614bf883c217b53b381419996eb..e9356a5afc9c39a086ced0e69540041621acbba0 100644
126--- a/.github/workflows/pr-comment.yml
127+++ b/.github/workflows/pr-comment.yml
128@@ -1,63 +1,10 @@
129-name: Comment on pull request
130+name: pr-comment
131+
132 on:
133   workflow_run:
134     workflows: [build]
135     types: [completed]
136-jobs:
137-  pr_comment:
138-    if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
139-    runs-on: ubuntu-latest
140-    steps:
141-      - uses: actions/github-script@v5
142-        with:
143-          # This snippet is public-domain, taken from
144-          # https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
145-          script: |
146-            async function upsertComment(owner, repo, issue_number, purpose, body) {
147-              const {data: comments} = await github.rest.issues.listComments(
148-                {owner, repo, issue_number});
149-
150-              const marker = `<!-- bot: ${purpose} -->`;
151-              body = marker + "\n" + body;
152-
153-              const existing = comments.filter((c) => c.body.includes(marker));
154-              if (existing.length > 0) {
155-                const last = existing[existing.length - 1];
156-                core.info(`Updating comment ${last.id}`);
157-                await github.rest.issues.updateComment({
158-                  owner, repo,
159-                  body,
160-                  comment_id: last.id,
161-                });
162-              } else {
163-                core.info(`Creating a comment in issue / PR #${issue_number}`);
164-                await github.rest.issues.createComment({issue_number, body, owner, repo});
165-              }
166-            }
167-
168-            const {owner, repo} = context.repo;
169-            const run_id = ${{github.event.workflow_run.id}};
170 
171-            const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};
172-            if (!pull_requests.length) {
173-              return core.error("This workflow doesn't match any pull requests!");
174-            }
175-
176-            const artifacts = await github.paginate(
177-              github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id});
178-            if (!artifacts.length) {
179-              return core.error(`No artifacts found`);
180-            }
181-            const sha = "${{github.event.workflow_run.head_sha}}";
182-            let body = `Download the artifacts for this pull request:\n`;
183-            for (const art of artifacts) {
184-              body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
185-            }
186-            body += `\n\nOr use the following Docker image \`ghcr.io/${owner}/${repo}:devel-${sha.substr(0,7)}\``;
187-
188-            core.info("Review thread message body:", body);
189-
190-            for (const pr of pull_requests) {
191-              await upsertComment(owner, repo, pr.number,
192-                "nightly-link", body);
193-            }
194+jobs:
195+  pr-comment:
196+    uses: charmbracelet/meta/.github/workflows/pr-comment.yml@main