-
Notifications
You must be signed in to change notification settings - Fork 54
164 lines (160 loc) · 5.94 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
name: Build
on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]
jobs:
build-athena:
name: "Build for Athena"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: "Install RoboRIO toolchain"
run: ./gradlew :akit:installRoboRioToolchain
- name: "Build and test"
run: ./gradlew :akit:build -Ponlylinuxathena
- name: "Development: Publish local"
if: github.event_name != 'release'
run: ./gradlew :akit:publishAllPublicationsToMavenRepository -Ponlylinuxathena
- name: "Release: Get version number"
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
- name: "Release: Get release info"
id: get_release_info
if: github.event_name == 'release'
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Release: Publish remote"
if: github.event_name == 'release'
run: ./gradlew :akit:publish -Ponlylinuxathena "-PpublishingVersion=${{ steps.get_version.outputs.version-without-v }}"
env:
GITHUB_ACTOR: Mechanical-Advantage
GITHUB_TOKEN: ${{ github.token }}
- name: "Release: Upload vendordep"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: akit/build/vendordep/AdvantageKit.json
asset_name: AdvantageKit.json
asset_content_type: application/json
- name: "Upload local repo"
uses: actions/upload-artifact@v4
with:
name: maven_Athena
path: akit/build/repos/releases
build-desktop:
strategy:
matrix:
include:
- name: "Linux"
runner-image: ubuntu-latest
classifier: "linuxx86-64"
- name: "macOS"
runner-image: macos-latest
classifier: "osxuniversal"
- name: "Windows"
runner-image: windows-latest
classifier: "windowsx86-64"
name: "Build for ${{ matrix.name }}"
runs-on: ${{ matrix.runner-image }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: "Install Python dependencies"
run: pip install requests
- name: "Build and test"
run: ./gradlew :akit:build -Ponly${{ matrix.classifier }} -PskipJava=1
- name: "Development: Publish local"
if: github.event_name != 'release'
run: ./gradlew :akit:publishAllPublicationsToMavenRepository -Ponly${{ matrix.classifier }} -PskipJava=1
- name: "Release: Get version number"
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
- name: "Release: Publish local"
if: github.event_name == 'release'
run: ./gradlew :akit:publishAllPublicationsToMavenRepository -Ponly${{ matrix.classifier }} -PskipJava=1 "-PpublishingVersion=${{ steps.get_version.outputs.version-without-v }}"
- name: "Release: Publish zip"
if: github.event_name == 'release'
run: |
python publish_zip.py --url https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit --group_id org.littletonrobotics.akit --artifact_id akit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.classifier }} --file_path akit/build/outputs/_M__GROUP_org_littletonrobotics_akit_ID_akit-wpilibio_CLS-${{ matrix.classifier }}.zip --username Mechanical-Advantage --access_token ${{ secrets.GITHUB_TOKEN }}
- name: "Upload local repo"
uses: actions/upload-artifact@v4
with:
name: maven_${{ matrix.name }}
path: akit/build/repos/releases
combine:
name: "Combine Maven Offline"
runs-on: ubuntu-latest
needs: [build-athena, build-desktop]
steps:
- name: "Download Athena"
uses: actions/download-artifact@v4
with:
name: maven_Athena
path: maven_Athena
- name: "Download Linux"
uses: actions/download-artifact@v4
with:
name: maven_Linux
path: maven_Linux
- name: "Download macOS"
uses: actions/download-artifact@v4
with:
name: maven_macOS
path: maven_macOS
- name: "Download Windows"
uses: actions/download-artifact@v4
with:
name: maven_Windows
path: maven_Windows
- name: "Combine"
run: |
rsync -a maven_Athena/* maven_offline
rsync -a maven_macOS/* maven_offline
rsync -a maven_Linux/* maven_offline
rsync -a maven_Windows/* maven_offline
zip -r maven_offline.zip maven_offline
- name: "Upload artifact"
uses: actions/upload-artifact@v4
with:
name: maven
path: maven_offline
- name: "Release: Get release info"
id: get_release_info
if: github.event_name == 'release'
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Release: Upload artifact"
uses: actions/upload-release-asset@v1
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: maven_offline.zip
asset_name: maven_offline.zip
asset_content_type: application/zip