Skip to content

Commit

Permalink
Merge pull request #67 from earthly/ido-auto-update-dist-for-renovate
Browse files Browse the repository at this point in the history
Auto update dist for renovate
  • Loading branch information
idodod authored Mar 26, 2024
2 parents dc23b46 + 1cdb55c commit fcc9066
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/renovate-helper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update Renovate Branch

on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
update-renovate-branch:
if: github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'renovate/') && github.head_ref == 'renovate[bot]'
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
EARTHLY_CONVERSION_PARALLELISM: "5"
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-actions-setup-githubactions"
steps:
- uses: earthly/actions/setup-earthly@v1
with:
version: v0.8.6
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Update Branch
run: earthly --ci -P --push +update-dist
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- "main"
- "releases/*"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
23 changes: 23 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
VERSION 0.8

PROJECT earthly-technologies/core

npm-base:
FROM node:21.7-alpine3.19
COPY ./package.json ./
Expand Down Expand Up @@ -93,6 +95,27 @@ lint-newline:
done; \
exit $code

update-dist-for-renovate:
FROM alpine/git
RUN git config --global user.name "renovate[bot]" && \
git config --global user.email "renovate[bot]@users.noreply.github.com" && \
git config --global url."[email protected]:".insteadOf "https://github.com/"

ARG git_repo="earthly/actions-setup"
ARG git_url="[email protected]:$git_repo"
ARG earthly_lib_version=3.0.1
ARG SECRET_PATH=littleredcorvette-id_rsa
DO --pass-args github.com/earthly/lib/utils/git:$earthly_lib_version+DEEP_CLONE \
--GIT_URL=$git_url --SECRET_PATH=$SECRET_PATH

ARG EARTHLY_GIT_BRANCH
LET branch=$EARTHLY_GIT_BRANCH
RUN --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa \
git checkout $branch
COPY --dir +compile/dist .
RUN git add dist && git commit -m "update dist for Renovate" || echo nothing to commit
RUN --push --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa \
git push origin $branch

all:
BUILD +lint
Expand Down

0 comments on commit fcc9066

Please sign in to comment.