-
Notifications
You must be signed in to change notification settings - Fork 42
169 lines (143 loc) · 4.88 KB
/
build.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
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
name: Build and Release
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
build_for_linux:
runs-on: ubuntu-latest
name: Build for Linux
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache Docker layers
uses: satackey/[email protected]
with:
key: docker-layers-linux-{hash}
restore-keys: |
docker-layers-linux-
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Build Docker builder image
run: docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f .github/docker/linux/Dockerfile -t builder .
- name: Build
run: docker run --rm -e CI -v $(pwd):/app -w /app builder
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jvips-libs-linux
path: JVips-libs.tar.gz
build_for_windows:
runs-on: ubuntu-latest
name: Build for Windows
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker builder image
run: docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f .github/docker/windows/Dockerfile -t builder .
- name: Build
run: docker run --rm -e CI -v $(pwd):/app -w /app builder
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jvips-libs-windows
path: JVips-libs.tar.gz
build_for_macos:
runs-on: macos-latest
name: Build for macOS
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Select Java
uses: actions/setup-java@v1
with:
java-version: "1.8.0"
java-package: jdk
architecture: x64
- name: Install vips
run: ./setup-for-macos.sh
- name: Build
run: ./build.sh --with-macos --without-w64 --without-linux
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jvips-libs-macos
path: JVips-libs.tar.gz
release:
needs: [build_for_linux, build_for_macos, build_for_windows]
if: contains('refs/heads/master', github.ref)
runs-on: ubuntu-latest
name: Merge macOS, Linux, Windows artifacts into a JAR and release it
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read GPG private key
run: echo -ne "$GPG_PRIVATE_KEY" | base64 --decode > $RUNNER_TEMP/key.asc
env:
GPG_PRIVATE_KEY: ${{ secrets.MAVEN_SECRING_GPG_BASE64 }}
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Extract libraries
run: for jar in artifacts/*/JVips-libs.tar.gz; do tar xvf $jar; done
- name: Set version
id: version
run: |
source lib/VERSIONS
VERSION="${VIPS_VERSION}-$(git rev-parse --short HEAD)"
mvn -B versions:set -DnewVersion=$VERSION
echo "::set-output name=version::$VERSION"
- name: Set up Maven Central Repository
uses: warrenseine/setup-java@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
java-version: "1.8.0"
java-package: jdk
architecture: x64
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key-path: ${{ runner.temp }}/key.asc
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Clean GPG private key
if: ${{ always() }}
run: rm -f $RUNNER_TEMP/key.asc
- name: Publish to the Maven Central Repository
run: mvn -B -DskipTests -P deploy deploy
env:
MAVEN_USERNAME: criteo-oss
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_SECRING_PASSWORD }}
# - name: Publish to GitHub Packages
# run: mvn -B -DskipTests -P deploy deploy
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jvips
path: JVips.jar
- name: Create release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: ${{ steps.version.outputs.version }}
draft: false
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: JVips.jar
asset_name: JVips.jar
asset_content_type: application/java-archive