Updated repository in packages branch #61
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
name: Updated repository in packages branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: "maven" | |
#Manually first (once) set up an orphaned branch: | |
# git switch --orphan packages | |
# git commit --allow-empty -m "Initial commit on packages branch" | |
# git push origin packages:packages | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Compile and install locally | |
run: | | |
mkdir -p repository/com/eficode/devstack | |
mkdir -p repository/com/eficode/devstack-standalone | |
echo Building and installing "normal" version | |
mvn install -f pom.xml -DcreateChecksum=true -DskipTests | |
echo Creating pom for standalone version and installing | |
mvn gplus:execute@execute | |
mvn install -f pom-standalone.xml -DcreateChecksum=true -DskipTests | |
- name: Copying JAR files | |
run: | | |
echo Copying the new JAR files to repository which will be added to git branch "packages" | |
rsync -avh --checksum ~/.m2/repository/com/eficode/devstack/ repository/com/eficode/devstack/ | |
rsync -avh --checksum ~/.m2/repository/com/eficode/devstack-standalone/ repository/com/eficode/devstack-standalone/ | |
- name: Committing and pushing JAR files | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
echo Adding repository dir temporarily so stash picks it up | |
git add repository | |
echo Stashing current changes | |
git stash | |
echo Running git fetch | |
git fetch | |
echo Checking out Packages repo | |
git checkout packages | |
echo Applying stash, overwriting any checked out changes | |
git checkout stash -- . | |
echo Running git reset, to ignore any automatically added tracked changes | |
git reset | |
echo Adding repository files to git | |
git add repository/* | |
echo Committing changes | |
git commit -m "Updated packages" | |
echo Pushing changes | |
git push | |