diff --git a/.github/workflows/check_repo.yml b/.github/workflows/check_repo.yml new file mode 100644 index 00000000..5257715f --- /dev/null +++ b/.github/workflows/check_repo.yml @@ -0,0 +1,40 @@ +name: "Push repo to aws github codecommit" + +# if you want manually trigger this action pls unmark this line +# on: [ workflow_dispatch ] +on: + push: + branches: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Extract branch name + shell: bash + run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}" + id: extract_branch + + - name: Push to AWS CodeCommit + env: + CODECOMMIT_HOST: ${{ secrets.CODECOMMIT_REPO_HOST }} + CODECOMMIT_REPO_URL: ${{ secrets.CODECOMMIT_REPO_URL }} + CODECOMMIT_SSH_CONFIG: ${{ secrets.CODECOMMIT_SSH_CONFIG }} + CODECOMMIT_SSH_PRIVATE_KEY: ${{ secrets.CODECOMMIT_SSH_PRIVATE_KEY }} + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + shell: bash + run: | + mkdir ~/.ssh + echo "$CODECOMMIT_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + echo "$CODECOMMIT_SSH_CONFIG" > ~/.ssh/config && chmod 600 ~/.ssh/config + ssh-keyscan "$CODECOMMIT_HOST" >> ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts + git remote add codecommit "$CODECOMMIT_REPO_URL" + git push codecommit ${{ env.BRANCH_NAME }}:${{ env.BRANCH_NAME }} -f diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 00000000..47f24e11 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,30 @@ +# This is a basic workflow that is manually triggered + +name: Manual workflow + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + name: + # Friendly description to be shown in the UI instead of 'name' + description: 'Person to greet' + # Default value if no value is explicitly provided + default: 'World' + # Input has to be provided for the workflow to run + required: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + greet: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a single command using the runners shell + - name: Send greeting + run: echo "Hello ${{ github.event.inputs.name }}" diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 17d38b10..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,21 +0,0 @@ -pipeline { - agent any - - stages { - stage('Validate') { - steps { - sh 'mvn validate' - } - } - stage('Unit Test') { - steps { - sh 'mvn test' - } - } - stage('Build') { - steps { - sh 'mvn package' - } - } - } -}