forked from makeplane/plane
-
Notifications
You must be signed in to change notification settings - Fork 11
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 #22 from torbenraab/preview
release: v0.16-dev
- Loading branch information
Showing
253 changed files
with
5,357 additions
and
4,525 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
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,97 @@ | ||
name: Auto Merge or Create PR on Push | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "sync/**" | ||
|
||
env: | ||
CURRENT_BRANCH: ${{ github.ref_name }} | ||
SOURCE_BRANCH: ${{ secrets.SYNC_TARGET_BRANCH_NAME }} # The sync branch such as "sync/ce" | ||
TARGET_BRANCH: ${{ secrets.TARGET_BRANCH }} # The target branch that you would like to merge changes like develop | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # Personal access token required to modify contents and workflows | ||
REVIEWER: ${{ secrets.REVIEWER }} | ||
|
||
jobs: | ||
Check_Branch: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
BRANCH_MATCH: ${{ steps.check-branch.outputs.MATCH }} | ||
steps: | ||
- name: Check if current branch matches the secret | ||
id: check-branch | ||
run: | | ||
if [ "$CURRENT_BRANCH" = "$SOURCE_BRANCH" ]; then | ||
echo "MATCH=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "MATCH=false" >> $GITHUB_OUTPUT | ||
fi | ||
Auto_Merge: | ||
if: ${{ needs.Check_Branch.outputs.BRANCH_MATCH == 'true' }} | ||
needs: [Check_Branch] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags | ||
|
||
- name: Setup GH CLI and Git Config | ||
run: | | ||
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | ||
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
sudo apt update | ||
sudo apt install gh -y | ||
- id: git-author | ||
name: Setup Git CLI from Github Token | ||
run: | | ||
VIEWER_JSON=$(gh api graphql -f query='query { viewer { name login databaseId }}' --jq '.data.viewer') | ||
VIEWER_NAME=$(jq --raw-output '.name | values' <<< "${VIEWER_JSON}") | ||
VIEWER_LOGIN=$(jq --raw-output '.login' <<< "${VIEWER_JSON}") | ||
VIEWER_DATABASE_ID=$(jq --raw-output '.databaseId' <<< "${VIEWER_JSON}") | ||
USER_NAME="${VIEWER_NAME:-${VIEWER_LOGIN}}" | ||
USER_EMAIL="${VIEWER_DATABASE_ID}+${VIEWER_LOGIN}@users.noreply.github.com" | ||
git config --global user.name ${USER_NAME} | ||
git config --global user.email ${USER_EMAIL} | ||
- name: Check for merge conflicts | ||
id: conflicts | ||
run: | | ||
git fetch origin $TARGET_BRANCH | ||
git checkout $TARGET_BRANCH | ||
# Attempt to merge the main branch into the current branch | ||
if $(git merge --no-commit --no-ff $SOURCE_BRANCH); then | ||
echo "No merge conflicts detected." | ||
echo "HAS_CONFLICTS=false" >> $GITHUB_ENV | ||
else | ||
echo "Merge conflicts detected." | ||
echo "HAS_CONFLICTS=true" >> $GITHUB_ENV | ||
git merge --abort | ||
fi | ||
- name: Merge Change to Target Branch | ||
if: env.HAS_CONFLICTS == 'false' | ||
run: | | ||
git commit -m "Merge branch '$SOURCE_BRANCH' into $TARGET_BRANCH" | ||
git push origin $TARGET_BRANCH | ||
- name: Create PR to Target Branch | ||
if: env.HAS_CONFLICTS == 'true' | ||
run: | | ||
# Use GitHub CLI to create PR and specify author and committer | ||
PR_URL=$(gh pr create --base $TARGET_BRANCH --head $SOURCE_BRANCH \ | ||
--title "sync: merge conflicts need to be resolved" \ | ||
--body "" \ | ||
--reviewer $REVIEWER ) | ||
echo "Pull Request created: $PR_URL" | ||
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 |
---|---|---|
|
@@ -23,6 +23,10 @@ jobs: | |
gh_buildx_version: ${{ steps.set_env_variables.outputs.BUILDX_VERSION }} | ||
gh_buildx_platforms: ${{ steps.set_env_variables.outputs.BUILDX_PLATFORMS }} | ||
gh_buildx_endpoint: ${{ steps.set_env_variables.outputs.BUILDX_ENDPOINT }} | ||
build_frontend: ${{ steps.changed_files.outputs.frontend_any_changed }} | ||
build_space: ${{ steps.changed_files.outputs.space_any_changed }} | ||
build_backend: ${{ steps.changed_files.outputs.backend_any_changed }} | ||
build_proxy: ${{ steps.changed_files.outputs.proxy_any_changed }} | ||
|
||
steps: | ||
- id: set_env_variables | ||
|
@@ -41,9 +45,37 @@ jobs: | |
fi | ||
echo "TARGET_BRANCH=${{ env.TARGET_BRANCH }}" >> $GITHUB_OUTPUT | ||
- id: checkout_files | ||
name: Checkout Files | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get changed files | ||
id: changed_files | ||
uses: tj-actions/changed-files@v42 | ||
with: | ||
files_yaml: | | ||
frontend: | ||
- web/** | ||
- packages/** | ||
- 'package.json' | ||
- 'yarn.lock' | ||
- 'tsconfig.json' | ||
- 'turbo.json' | ||
space: | ||
- space/** | ||
- packages/** | ||
- 'package.json' | ||
- 'yarn.lock' | ||
- 'tsconfig.json' | ||
- 'turbo.json' | ||
backend: | ||
- apiserver/** | ||
proxy: | ||
- nginx/** | ||
branch_build_push_frontend: | ||
if: ${{ (needs.branch_build_setup.outputs.build_frontend == 'true' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master') && !contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
runs-on: ubuntu-20.04 | ||
if: ${{ !contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
needs: [branch_build_setup] | ||
env: | ||
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:${{ needs.branch_build_setup.outputs.gh_branch_name }} | ||
|
@@ -56,9 +88,9 @@ jobs: | |
- name: Set Frontend Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:latest | ||
else | ||
TAG=${{ env.FRONTEND_TAG }} | ||
fi | ||
|
@@ -96,7 +128,7 @@ jobs: | |
|
||
branch_build_frontend_amd64: | ||
runs-on: ubuntu-20.04 | ||
if: ${{ contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
if: ${{ github.event_name == 'release' && contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
needs: [branch_build_setup] | ||
env: | ||
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ needs.branch_build_setup.outputs.gh_branch_name }} | ||
|
@@ -109,9 +141,9 @@ jobs: | |
- name: Set Frontend Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:latest | ||
else | ||
TAG=${{ env.FRONTEND_TAG }} | ||
fi | ||
|
@@ -149,7 +181,7 @@ jobs: | |
|
||
branch_build_frontend_arm64: | ||
runs-on: [self-hosted, linux, ARM64] | ||
if: ${{ contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
if: ${{ github.event_name == 'release' && contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
needs: [branch_build_setup] | ||
env: | ||
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ needs.branch_build_setup.outputs.gh_branch_name }} | ||
|
@@ -162,9 +194,9 @@ jobs: | |
- name: Set Frontend Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:stable | ||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend:latest | ||
else | ||
TAG=${{ env.FRONTEND_TAG }} | ||
fi | ||
|
@@ -185,7 +217,7 @@ jobs: | |
endpoint: ${{ env.BUILDX_ENDPOINT }} | ||
|
||
- name: Check out the repo | ||
uses: actions/checkout@v4.1.1 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and Push Frontend to Docker Container Registry | ||
uses: docker/[email protected] | ||
|
@@ -203,7 +235,7 @@ jobs: | |
branch_push_frontend: | ||
runs-on: ubuntu-20.04 | ||
needs: [branch_build_setup, branch_build_frontend_amd64, branch_build_frontend_arm64] | ||
if: ${{ contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
if: ${{ github.event_name == 'release' && contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }} | ||
env: | ||
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ needs.branch_build_setup.outputs.gh_branch_name }} | ||
FRONTEND_TAG_AMD64: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ needs.branch_build_setup.outputs.gh_branch_name }} | ||
|
@@ -219,7 +251,7 @@ jobs: | |
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:latest | ||
else | ||
TAG=${{ env.FRONTEND_TAG }} | ||
fi | ||
|
@@ -259,13 +291,14 @@ jobs: | |
if: ${{ github.event_name == 'release' }} | ||
with: | ||
tags: | | ||
${{ env.FRONTEND_TAG }}:latest | ||
${{ env.FRONTEND_TAG }}:stable | ||
${{ env.FRONTEND_TAG }}:${{ github.event.release.tag_name }} | ||
sources: | | ||
${{ env.FRONTEND_TAG_AMD64 }} | ||
${{ env.FRONTEND_TAG_ARM64 }} | ||
branch_build_push_space: | ||
if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} | ||
runs-on: ubuntu-20.04 | ||
needs: [branch_build_setup] | ||
env: | ||
|
@@ -279,9 +312,9 @@ jobs: | |
- name: Set Space Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-space:latest | ||
else | ||
TAG=${{ env.SPACE_TAG }} | ||
fi | ||
|
@@ -302,7 +335,7 @@ jobs: | |
endpoint: ${{ env.BUILDX_ENDPOINT }} | ||
|
||
- name: Check out the repo | ||
uses: actions/checkout@v4.1.1 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and Push Space to Docker Hub | ||
uses: docker/[email protected] | ||
|
@@ -318,6 +351,7 @@ jobs: | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
branch_build_push_backend: | ||
if: ${{ needs.branch_build_setup.outputs.build_backend == 'true' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} | ||
runs-on: ubuntu-20.04 | ||
needs: [branch_build_setup] | ||
env: | ||
|
@@ -331,9 +365,9 @@ jobs: | |
- name: Set Backend Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-backend:latest | ||
else | ||
TAG=${{ env.BACKEND_TAG }} | ||
fi | ||
|
@@ -354,7 +388,7 @@ jobs: | |
endpoint: ${{ env.BUILDX_ENDPOINT }} | ||
|
||
- name: Check out the repo | ||
uses: actions/checkout@v4.1.1 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and Push Backend to Docker Hub | ||
uses: docker/[email protected] | ||
|
@@ -369,8 +403,8 @@ jobs: | |
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
|
||
branch_build_push_proxy: | ||
if: ${{ needs.branch_build_setup.outputs.build_proxy == 'true' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} | ||
runs-on: ubuntu-20.04 | ||
needs: [branch_build_setup] | ||
env: | ||
|
@@ -384,9 +418,9 @@ jobs: | |
- name: Set Proxy Docker Tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:latest,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:${{ github.event.release.tag_name }} | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:${{ github.event.release.tag_name }} | ||
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:stable | ||
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-proxy:latest | ||
else | ||
TAG=${{ env.PROXY_TAG }} | ||
fi | ||
|
@@ -407,7 +441,7 @@ jobs: | |
endpoint: ${{ env.BUILDX_ENDPOINT }} | ||
|
||
- name: Check out the repo | ||
uses: actions/checkout@v4.1.1 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and Push Plane-Proxy to Docker Hub | ||
uses: docker/[email protected] | ||
|
Oops, something went wrong.