-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (64 loc) · 2.55 KB
/
maven-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Updated repository in packages branch
on:
workflow_dispatch:
push:
branches:
- main
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@v3
with:
path: ~/.m2/repository
#Hardcoded key for now
key: Linux-maven-89b1c003ca3c48e37dc9ab839a69baacef3d9c8ff67ac39f8514de7290a6cf36
- name: Compile and install main version
run: |
echo Building and installing "normal" version
mvn install -f pom.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"
mkdir -p repository/com/eficode/atlassian/remotespock/
rsync -avh --checksum ~/.m2/repository/com/eficode/atlassian/remotespock/ repository/com/eficode/atlassian/remotespock/
- 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 to $VERSION"
echo Pushing changes
git push
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6