-
-
Notifications
You must be signed in to change notification settings - Fork 3
174 lines (170 loc) · 6.91 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Build Images
on:
push:
branches: [ main, micronaut ]
pull_request:
branches: [ main, micronaut ]
jobs:
build-non-windows-image:
name: 'Build Non-Windows Image'
needs: [ build-jar-job ]
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest' ]
include:
- os: 'ubuntu-latest'
label: 'linux'
- os: 'macos-latest'
label: 'mac'
runs-on: ${{ matrix.os }}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm' # See 'Options' for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
cache: 'gradle'
- name: Example step
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
- name: 'Publish Native Image'
if: success()
uses: actions/upload-artifact@v2-preview
with:
name: 'simple-socket-fn-logger-${{env.VERSION}}-${{matrix.label}}'
path: 'simple-socket-fn-logger-${{env.VERSION}}-all'
- name: 'Release Native Image Asset'
if: success() && contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{env.UPLOAD_URL}}
asset_name: 'simple-socket-fn-logger-${{env.VERSION}}-${{matrix.label}}'
asset_path: 'simple-socket-fn-logger-${{env.VERSION}}-all'
asset_content_type: application/octet-stream
publish-image:
matrix:
needs: test
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
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@v3
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 }}