From 3a82a5c26c5b54f5763166ed62722069a51197b2 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 16 Jul 2024 15:12:34 +0200 Subject: [PATCH] ajout github-actions --- .github/actions/git-repo-sync/action.yml | 27 ++++++++++++++++++++ .github/actions/git-repo-sync/entrypoint.sh | 14 ++++++++++ .github/workflows/git-repo-sync.yml | 19 ++++++++++++++ .gitlab-ci.yml | 8 ++++++ src/main/resources/assembly/distribution.xml | 2 ++ 5 files changed, 70 insertions(+) create mode 100644 .github/actions/git-repo-sync/action.yml create mode 100644 .github/actions/git-repo-sync/entrypoint.sh create mode 100644 .github/workflows/git-repo-sync.yml create mode 100644 .gitlab-ci.yml diff --git a/.github/actions/git-repo-sync/action.yml b/.github/actions/git-repo-sync/action.yml new file mode 100644 index 00000000..c8f3ad7c --- /dev/null +++ b/.github/actions/git-repo-sync/action.yml @@ -0,0 +1,27 @@ +name: 'Git Repo Sync' +description: 'Git Repo Sync enables you to synchronize code to other code management platforms, such as GitLab, Gitee, etc.' + +branding: + icon: upload-cloud + color: gray-dark + +inputs: + target-url: + description: 'Target Repo URL' + required: true + target-username: + description: 'Target Repo Username' + required: true + target-token: + description: 'Target Token' + required: true +runs: + using: "composite" + steps: + - run: ${{ github.action_path }}/entrypoint.sh + shell: bash + env: + INPUT_TARGET_URL: ${{ inputs.target-url }} + INPUT_TARGET_USERNAME: ${{ inputs.target-username }} + INPUT_TARGET_TOKEN: ${{ inputs.target-token }} + GITHUB_EVENT_REF: ${{ github.event.ref }} diff --git a/.github/actions/git-repo-sync/entrypoint.sh b/.github/actions/git-repo-sync/entrypoint.sh new file mode 100644 index 00000000..b8a1dcd1 --- /dev/null +++ b/.github/actions/git-repo-sync/entrypoint.sh @@ -0,0 +1,14 @@ +git remote add target https://${INPUT_TARGET_USERNAME}:${INPUT_TARGET_TOKEN}@${INPUT_TARGET_URL#https://} + +case "${GITHUB_EVENT_NAME}" in + push) + git push -f --all target + git push -f --tags target + ;; + delete) + git push -d target ${GITHUB_EVENT_REF} + ;; + *) + break + ;; +esac diff --git a/.github/workflows/git-repo-sync.yml b/.github/workflows/git-repo-sync.yml new file mode 100644 index 00000000..a5aaacdc --- /dev/null +++ b/.github/workflows/git-repo-sync.yml @@ -0,0 +1,19 @@ +name: GitlabSync + +on: + - push + - delete + +jobs: + sync: + runs-on: ubuntu-latest + name: Git Repo Sync + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: ./.github/actions/git-repo-sync + with: + target-url: ${{ secrets.TARGET_URL }} + target-username: ${{ secrets.TARGET_USERNAME }} + target-token: ${{ secrets.TARGET_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..ca5572bb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +include: + - project: 'dn-sied/ci-config' + file: '/.gitlab-ci-template-container-image.yml' + +variables: + CI_RULES: $CI_COMMIT_BRANCH == "saas" + MAVEN_IMAGE: maven:3-jdk-11 + MAVEN_ADDITIONAL_CLI_OPTS: "-Pcoverage,production" \ No newline at end of file diff --git a/src/main/resources/assembly/distribution.xml b/src/main/resources/assembly/distribution.xml index 5e3722d7..f6c0b0a5 100644 --- a/src/main/resources/assembly/distribution.xml +++ b/src/main/resources/assembly/distribution.xml @@ -52,6 +52,8 @@ .project .classpath .gitignore + .gitlab-ci.yml + **/.github/**