-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from earthly/ido-auto-update-major-branch
Auto update major branch upon a new release
- Loading branch information
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Update Major Version Branch | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
update-major-version-branch: | ||
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.ref }} | ||
- name: Update Branch | ||
run: earthly --ci -P +merge-release-to-major-branch --RELEASE_TAG=${{ github.ref }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ VERSION 0.8 | |
|
||
PROJECT earthly-technologies/core | ||
|
||
ARG EARTHLY_LIB_VERSION=3.0.1 | ||
IMPORT github.com/earthly/lib/utils/git:$EARTHLY_LIB_VERSION AS git | ||
|
||
npm-base: | ||
FROM node:21.7-alpine3.19 | ||
COPY ./package.json ./ | ||
|
@@ -103,10 +106,8 @@ update-dist-for-renovate: | |
|
||
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 | ||
DO --pass-args git+DEEP_CLONE --GIT_URL=$git_url --SECRET_PATH=$SECRET_PATH | ||
|
||
ARG EARTHLY_GIT_BRANCH | ||
LET branch=$EARTHLY_GIT_BRANCH | ||
|
@@ -117,6 +118,27 @@ update-dist-for-renovate: | |
RUN --push --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa \ | ||
git push origin $branch | ||
|
||
merge-release-to-major-branch: | ||
FROM alpine/git | ||
RUN git config --global user.name "littleredcorvette" && \ | ||
git config --global user.email "[email protected]" && \ | ||
git config --global url."[email protected]:".insteadOf "https://github.com/" | ||
|
||
ARG git_repo="earthly/actions-setup" | ||
ARG git_url="[email protected]:$git_repo" | ||
ARG SECRET_PATH=littleredcorvette-id_rsa | ||
DO --pass-args git+DEEP_CLONE --GIT_URL=$git_url --SECRET_PATH=$SECRET_PATH | ||
|
||
ARG --required RELEASE_TAG | ||
LET tag=${RELEASE_TAG#refs/tags/} | ||
LET major=$tag | ||
SET major=$(echo ${major%.*}) | ||
SET major=$(echo ${major%.*}) | ||
RUN --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa \ | ||
git checkout $major && git merge --ff-only $tag | ||
RUN --push --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa \ | ||
git push origin $major | ||
|
||
all: | ||
BUILD +lint | ||
BUILD +lint-newline | ||
|