-
-
Notifications
You must be signed in to change notification settings - Fork 3
146 lines (144 loc) · 7.38 KB
/
build-project.yaml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build and Verify
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
project: [ 'artifact-impl', 'artifact-query-impl', 'auth-impl', 'version-synchronizer', 'versions-impl', 'versions-query-impl' ]
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED
steps:
- uses: actions/checkout@v3
- name: Set up SBT
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build with SBT
run: sbt -v ${{matrix.project}}/test
publish-maven:
needs: test
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --illegal-access=permit
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --illegal-access=permit
steps:
- uses: actions/checkout@v3
- name: Set up SBT
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Set up sponge repo credentials
run: |
mkdir ~/.sbt
echo "realm=Sonatype Nexus Repository Manager" >> ~/.sbt/sponge_creds
echo "host=repo-new.spongepowered.org" >> ~/.sbt/sponge_creds
echo "user=${{ secrets.SPONGE_MAVEN_REPO_USER }}" >> ~/.sbt/sponge_creds
echo "password=${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}" >> ~/.sbt/sponge_creds
cat ~/.sbt/sponge_creds
- name: Publish To Sponge Repos
run: |
sbt -v publish
rm -f ~/.sbt/sponge_creds
env:
REPO_NAME: "Sponge Repository"
REPO_CREDENTIAL_FILE: "sponge_creds"
CI_SYSTEM: Github Actions
GITHUB_USERNAME: "${{ github.actor }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
SONATYPE_SNAPSHOT_REPO: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
SONATYPE_RELEASE_REPO: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
- name: Set up GitHub Packages credentials
run: |
mkdir -p ~/.sbt
rm -f ~/.sbt/.credentials
echo "realm=GitHub Packages" >> ~/.sbt/github_creds
echo "host=maven.pkg.github.com" >> ~/.sbt/github_creds
echo "user=${{ github.actor }}" >> ~/.sbt/github_creds
echo "password=${{ secrets.GITHUB_TOKEN }}" >> ~/.sbt/github_creds
- name: Publish to GitHub Packages
run: |
sbt -v publish
rm -f ~/.sbt/github_creds
env:
REPO_NAME: "GitHub Packages"
REPO_CREDENTIAL_FILE: "github_creds"
CI_SYSTEM: Github Actions
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_SNAPSHOT_REPO: "https://maven.pkg.github.com/SpongePowered/SystemOfADownload"
SONATYPE_RELEASE_REPO: "https://maven.pkg.github.com/SpongePowered/SystemOfADownload"
- name: Set up Maven Central credentials
run: |
mkdir -p ~/.sbt
rm -f ~/.sbt/.credentials
echo "realm=Maven Central" >> ~/.sbt/sonatype
echo "host=oss.sonatype.org" >> ~/.sbt/sonatype
echo "user=${{ secrets.SPONGE_MAVEN_OSSRH_USER }}" >> ~/.sbt/sonatype
echo "password=${{ secrets.SPONGE_MAVEN_OSSRH_PASSWORD }}" >> ~/.sbt/sonatype
- name: Publish to Maven Central
run: |
sbt -v publish
rm -f ~/.sbt/sonatype
env:
REPO_NAME: "Maven Central"
REPO_CREDENTIAL_FILE: "sonatype"
CI_SYSTEM: Github Actions
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_SNAPSHOT_REPO: "https://oss.sonatype.org/content/repositories/snapshots"
SONATYPE_RELEASE_REPO: "https://oss.sonatype.org/service/local/staging/deploy/maven2"
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
publish-docker-image:
needs: test
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
strategy:
matrix:
project: [ 'artifact-impl', 'artifact-query-impl', 'auth-impl', 'version-synchronizer', 'versions-impl', 'versions-query-impl' ]
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --illegal-access=permit
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 --illegal-access=permit
steps:
- uses: actions/checkout@v3
- name: Set up SBT
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build with SBT
run: sbt -v ${{matrix.project}}/Docker/stage
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.project }}/target/docker/stage/
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/spongepowered/systemofadownload-${{matrix.project}}:latest,ghcr.io/spongepowered/systemofadownload-${{matrix.project}}:${{ github.sha }},ghcr.io/spongepowered/systemofadownload-${{matrix.project}}:${{ github.ref_name }}