Skip to content

Commit

Permalink
feat: bring in v1.11.5 that was used to release 2.8.9 (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney authored Feb 27, 2024
1 parent 54c1ccb commit 08c4d14
Show file tree
Hide file tree
Showing 23 changed files with 769 additions and 193 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"concurrency":
"group": "check-${{ github.sha }}"
"env":
"RELEASE_LIB_REF": "${{ inputs.release_lib_ref }}"
"USE_GITHUB_APP_TOKEN": "${{ inputs.use_github_app_token }}"
"jobs":
"check":
"container":
"image": "grafana/loki-build-image:0.33.0"
"image": "${{ inputs.build_image }}"
"env":
"BUILD_IN_CONTAINER": false
"SKIP_VALIDATION": "${{ inputs.skip_validation }}"
Expand All @@ -15,6 +18,7 @@
"uses": "actions/checkout@v4"
"with":
"path": "lib"
"ref": "${{ env.RELEASE_LIB_REF }}"
"repository": "grafana/loki-release"
- "name": "fix git dubious ownership"
"run": |
Expand Down Expand Up @@ -85,7 +89,7 @@
EOF
"lint":
"container":
"image": "grafana/loki-build-image:0.33.0"
"image": "${{ inputs.build_image }}"
"env":
"BUILD_IN_CONTAINER": false
"SKIP_VALIDATION": "${{ inputs.skip_validation }}"
Expand All @@ -97,6 +101,7 @@
"uses": "actions/checkout@v4"
"with":
"path": "lib"
"ref": "${{ env.RELEASE_LIB_REF }}"
"repository": "grafana/loki-release"
- "name": "fix git dubious ownership"
"run": |
Expand Down Expand Up @@ -139,10 +144,10 @@
"uses": "golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5"
"with":
"only-new-issues": true
"version": "v1.55.1"
"version": "${{ inputs.golang_ci_lint_version }}"
"test":
"container":
"image": "grafana/loki-build-image:0.33.0"
"image": "${{ inputs.build_image }}"
"env":
"BUILD_IN_CONTAINER": false
"SKIP_VALIDATION": "${{ inputs.skip_validation }}"
Expand All @@ -154,6 +159,7 @@
"uses": "actions/checkout@v4"
"with":
"path": "lib"
"ref": "${{ env.RELEASE_LIB_REF }}"
"repository": "grafana/loki-release"
- "name": "fix git dubious ownership"
"run": |
Expand Down Expand Up @@ -189,11 +195,30 @@
"on":
"workflow_call":
"inputs":
"build_image":
"description": "loki build image to use"
"required": true
"type": "string"
"golang_ci_lint_version":
"default": "v1.55.1"
"description": "version of golangci-lint to use"
"required": false
"type": "string"
"release_lib_ref":
"default": "main"
"description": "git ref of release library to use"
"required": false
"type": "string"
"skip_validation":
"default": false
"description": "skip validation steps"
"required": false
"type": "boolean"
"use_github_app_token":
"default": true
"description": "whether to use the GitHub App token for GH_TOKEN secret"
"required": false
"type": "boolean"
"permissions":
"contents": "write"
"id-token": "write"
Expand Down
71 changes: 61 additions & 10 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ concurrency:
env:
DOCKER_USERNAME: "grafana"
IMAGE_PREFIX: "trevorwhitney075"
RELEASE_LIB_REF: "release-1.11.x"
RELEASE_REPO: "grafana/loki-release"
SKIP_VALIDATION: false
USE_GITHUB_APP_TOKEN: true
VERSIONING_STRATEGY: "always-bump-patch"
jobs:
check:
uses: "./.github/workflows/check.yml"
with:
build_image: "grafana/loki-build-image:0.33.0"
golang_ci_lint_version: "v1.55.1"
release_lib_ref: "release-1.11.x"
skip_validation: false
use_github_app_token: true
create-release-pr:
needs:
- "dist"
Expand All @@ -26,6 +32,7 @@ jobs:
uses: "actions/checkout@v4"
with:
path: "lib"
ref: "${{ env.RELEASE_LIB_REF }}"
repository: "grafana/loki-release"
- name: "setup node"
uses: "actions/setup-node@v4"
Expand All @@ -36,24 +43,42 @@ jobs:
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
working-directory: "release"
- id: "get_github_app_token"
if: "${{ fromJSON(env.USE_GITHUB_APP_TOKEN) }}"
name: "get github app token"
uses: "actions/github-app-token@v1"
with:
app-id: "${{ secrets.APP_ID }}"
owner: "${{ github.repository_owner }}"
private-key: "${{ secrets.APP_PRIVATE_KEY }}"
- id: "github_app_token"
name: "set github token"
run: |
if [[ "${USE_GITHUB_APP_TOKEN}" == "true" ]]; then
echo "token=${{ steps.get_github_app_token.outputs.token }}" >> $GITHUB_OUTPUT
else
echo "token=${{ secrets.GH_TOKEN }}" >> $GITHUB_OUTPUT
fi
- env:
SHA: "${{ github.sha }}"
id: "release"
name: "release please"
run: |
npm install
echo "Pull request footer: Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}"
npm exec -- release-please release-pr \
--consider-all-branches \
--label "backport main,autorelease: pending,type/docs" \
--group-pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--label "backport main,autorelease: pending,product-approved" \
--manifest-file .release-please-manifest.json \
--pull-request-footer "Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" \
--pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--release-type simple \
--repo-url "${{ env.RELEASE_REPO }}" \
--target-branch "${{ steps.extract_branch.outputs.branch }}" \
--token "${{ secrets.GH_TOKEN }}" \
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" \
--separate-pull-requests false \
--debug
--target-branch "${{ steps.extract_branch.outputs.branch }}" \
--token "${{ steps.github_app_token.outputs.token }}" \
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}"
working-directory: "lib"
dist:
needs:
Expand Down Expand Up @@ -81,7 +106,8 @@ jobs:
DRONE_TAG: "${{ needs.version.outputs.version }}"
IMAGE_TAG: "${{ needs.version.outputs.version }}"
NFPM_SIGNING_KEY_FILE: "nfpm-private-key.key"
SKIP_ARM: true
SKIP_ARM: false
if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "build artifacts"
run: |
cat <<EOF | docker run \
Expand All @@ -101,7 +127,8 @@ jobs:
make dist packages
EOF
working-directory: "release"
- name: "upload build artifacts"
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "upload artifacts"
uses: "google-github-actions/upload-cloud-storage@v2"
with:
destination: "loki-build-artifacts/${{ github.sha }}"
Expand All @@ -116,6 +143,7 @@ jobs:
uses: "actions/checkout@v4"
with:
path: "lib"
ref: "${{ env.RELEASE_LIB_REF }}"
repository: "grafana/loki-release"
- name: "pull code to release"
uses: "actions/checkout@v4"
Expand Down Expand Up @@ -179,6 +207,7 @@ jobs:
uses: "actions/checkout@v4"
with:
path: "lib"
ref: "${{ env.RELEASE_LIB_REF }}"
repository: "grafana/loki-release"
- name: "pull code to release"
uses: "actions/checkout@v4"
Expand All @@ -194,6 +223,22 @@ jobs:
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
working-directory: "release"
- id: "get_github_app_token"
if: "${{ fromJSON(env.USE_GITHUB_APP_TOKEN) }}"
name: "get github app token"
uses: "actions/github-app-token@v1"
with:
app-id: "${{ secrets.APP_ID }}"
owner: "${{ github.repository_owner }}"
private-key: "${{ secrets.APP_PRIVATE_KEY }}"
- id: "github_app_token"
name: "set github token"
run: |
if [[ "${USE_GITHUB_APP_TOKEN}" == "true" ]]; then
echo "token=${{ steps.get_github_app_token.outputs.token }}" >> $GITHUB_OUTPUT
else
echo "token=${{ secrets.GH_TOKEN }}" >> $GITHUB_OUTPUT
fi
- id: "version"
name: "get release version"
run: |
Expand All @@ -202,12 +247,18 @@ jobs:
--consider-all-branches \
--dry-run \
--dry-run-output release.json \
--group-pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--manifest-file .release-please-manifest.json \
--pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--release-type simple \
--repo-url="${{ env.RELEASE_REPO }}" \
--repo-url "${{ env.RELEASE_REPO }}" \
--separate-pull-requests false \
--target-branch "${{ steps.extract_branch.outputs.branch }}" \
--token="${{ secrets.GH_TOKEN }}" \
--token "${{ steps.github_app_token.outputs.token }}" \
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}"
cat release.json
if [[ `jq length release.json` -gt 1 ]]; then
echo 'release-please would create more than 1 PR, so cannot determine correct version'
echo "pr_created=false" >> $GITHUB_OUTPUT
Expand Down
Loading

0 comments on commit 08c4d14

Please sign in to comment.