Skip to content

Commit

Permalink
Merge pull request #49 from Alfresco/feature/APPS-1793_migration_to_gha
Browse files Browse the repository at this point in the history
Feature/apps 1793 migration to gha
  • Loading branch information
kavitshah-gl authored Jan 14, 2023
2 parents e942040 + baa3216 commit f62af77
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 61 deletions.
144 changes: 144 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
on:
push:
branches:
- develop
- "APPS-**"
- /support\/.*/
pull_request:
branches:
- develop

workflow_dispatch:
inputs:
commitMessage:
description: Enter the Commit Message
required: true

env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GIT_EMAIL: ${{ secrets.BOT_GITHUB_EMAIL }}
GIT_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }}
GIT_PASSWORD: ${{ secrets.BOT_GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.ref_name }}


jobs:
Source_Clear_Scan:
if: ${{ startsWith(github.ref_name, 'support/') && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[no_release]') && github.event.repository.fork==false }}
runs-on: ubuntu-latest
needs: Build_and_test
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: "Setup maven"
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v surf/_ci/settings.xml ${HOME}/.m2/ || cp -v surf/_ci/.travis.settings.xml ${HOME}/.m2/settings.xml
- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: "Starting Source Clear Script"
run: bash surf/_ci/source_clear.sh

Build_and_test:
runs-on: ubuntu-latest
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: "Run script"
run: |
cd surf
cp _ci/.travis.settings.xml $HOME/.m2/settings.xml
mvn clean
mvn install -DskipTests=true -B -V
mvn test
Release:
if: ${{ startsWith(github.ref_name, 'support/') && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[no_release]') && github.event.repository.fork==false }}
runs-on: ubuntu-latest
needs: Source_Clear_Scan
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: "Setup maven"
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v surf/_ci/settings.xml ${HOME}/.m2/ || cp -v surf/_ci/.travis.settings.xml ${HOME}/.m2/settings.xml
- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Get branch name
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]

- name: "Use full history for release"
run: git checkout -B "$BRANCH_NAME"

- name: "Get the latest changes on branch"
run: git pull

- name: "Add email to link commits to user"
run: git config user.email "${GIT_EMAIL}"

- name: "Add user name to link commits to user"
run: git config user.name "${GIT_USERNAME}"

- name: "Skip building of release commits"
run: mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests -Darguments=-Dmaven.javadoc.skip=true release:clean release:prepare release:perform
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

0 comments on commit f62af77

Please sign in to comment.