Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add packaging script and action #154

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 90 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
- 'extras/**'
- LICENSE
- README.md

jobs:
shared:
runs-on: ubuntu-latest
Expand All @@ -23,6 +22,12 @@ jobs:
- run: python3 script/deploy_shared.py
env:
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}
- name: upload classes
uses: actions/upload-artifact@v2
with:
name: classes
path: |
shared/target/classes

windows:
runs-on: windows-latest
Expand All @@ -42,6 +47,25 @@ jobs:
- run: python3 script/deploy_native.py
env:
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}
- name: upload native artifact
uses: actions/upload-artifact@v2
with:
name: native
path: |
windows/build/jwm_x64.dll
windows/build/jwm.version
- name: upload classes
uses: actions/upload-artifact@v2
with:
name: classes
path: |
windows/target/classes
- name: upload delomboked
uses: actions/upload-artifact@v2
with:
name: delomboked
path: |
windows/target/delomboked

macos:
runs-on: macos-10.15
Expand All @@ -60,7 +84,25 @@ jobs:
- run: python3 script/deploy_native.py --arch=arm64
env:
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}

- name: upload native artifact
uses: actions/upload-artifact@v2
with:
name: native
path: |
macos/build/libjwm_x64.dylib
macos/build/libjwm_arm64.dylib
- name: upload classes
uses: actions/upload-artifact@v2
with:
name: classes
path: |
macos/target/classes
- name: upload delomboked
uses: actions/upload-artifact@v2
with:
name: delomboked
path: |
macos/target/delomboked
linux:
runs-on: ubuntu-latest
container: tonsky/jwm:latest
Expand All @@ -71,4 +113,49 @@ jobs:
fetch-depth: 0
- run: bash -c 'source /etc/profile && python3 script/deploy_native.py'
env:
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}
- name: upload native artifact
uses: actions/upload-artifact@v2
with:
name: native
path: |
linux/build/libjwm_x64.so
- name: upload classes
uses: actions/upload-artifact@v2
with:
name: classes
path: |
linux/target/classes
- name: upload delomboked
uses: actions/upload-artifact@v2
with:
name: delomboked
path: |
linux/target/delomboked


full:
runs-on: ubuntu-latest
needs: [linux,macos,windows]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: native
path: full/build
- uses: actions/download-artifact@v2
with:
name: classes
path: full/target/classes
- uses: actions/download-artifact@v2
with:
name: delomboked
path: full/target/delomboked
- run: |
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
echo "$JAVA_HOME_11_X64/bin" >> $GITHUB_PATH
- run: python3 ./script/deploy_full.py
env:
SPACE_TOKEN: ${{ secrets.SPACE_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
artifactId=jwm-full
groupId=org.jetbrains.jwm
version=0.0.0-SNAPSHOT
25 changes: 25 additions & 0 deletions full/deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.jwm</groupId>
<artifactId>jwm-full</artifactId>
<version>0.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>20.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>space-maven</id>
<url>https://packages.jetbrains.team/maven/p/jwm/maven</url>
</repository>
</distributionManagement>
</project>
12 changes: 12 additions & 0 deletions full/deploy/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>space-maven</id>
<username>${space.username}</username>
<password>${space.password}</password>
</server>
</servers>
</settings>
90 changes: 90 additions & 0 deletions script/deploy_full.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#! /usr/bin/env python3
import argparse, build, clean, common, glob, os, platform, revision, subprocess, sys

def main():
parser = argparse.ArgumentParser()
parser.add_argument("--dry-run", action="store_true")
(args, _) = parser.parse_known_args()


# Update poms
os.chdir(os.path.dirname(__file__) + "/../" + "full")
rev = revision.revision()

with open("deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.xml", "r+") as f:
pomxml = f.read()
f.seek(0)
f.write(pomxml.replace("0.0.0-SNAPSHOT", rev))
f.truncate()

with open("deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.properties", "r+") as f:
pomprops = f.read()
f.seek(0)
f.write(pomprops.replace("0.0.0-SNAPSHOT", rev))
f.truncate()

# .jar
print("Packaging " + "jwm-full-" + rev + ".jar")
subprocess.check_call(["jar",
"--create",
"--file", "target/jwm-full-" + rev + ".jar",
"-C","build","libjwm_x64.dylib",
"-C","build","libjwm_arm64.dylib",
"-C", "build", "libjwm_x64.so",
"-C","build","jwm_x64.dll",
"-C", "build", "jwm.version",
"-C", "target/classes", ".",
"-C", "deploy", "META-INF/maven/org.jetbrains.jwm/jwm-full"
])

if not args.dry_run:
print("Deploying", "jwm-full-" + rev + ".jar")
subprocess.check_call([
common.mvn,
"--batch-mode",
"--settings", "deploy/settings.xml",
"-Dspace.username=Nikita.Prokopov",
"-Dspace.password=" + os.getenv("SPACE_TOKEN"),
"deploy:deploy-file",
"-Dfile=target/jwm-full-" + rev + ".jar",
"-DpomFile=deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.xml",
"-DrepositoryId=space-maven",
"-Durl=" + common.space_jwm,
])

print("Packaging " + "jwm-full-" + rev + "-sources.jar")
subprocess.check_call([
"jar",
"--create",
"--file", "target/jwm-full-" + rev + "-sources.jar",
"-C", "target/delomboked", ".",
"-C", "deploy", "META-INF/maven/org.jetbrains.jwm/jwm-full"
])

if not args.dry_run:
print("Deploying " + "jwm-full-" + rev + "-sources.jar")
subprocess.check_call([
"mvn",
"--batch-mode",
"--settings", "deploy/settings.xml",
"-Dspace.username=Nikita.Prokopov",
"-Dspace.password=" + os.getenv("SPACE_TOKEN"),
"deploy:deploy-file",
"-Dpackaging=java-source",
"-Dfile=target/jwm-full-" + rev + "-sources.jar",
"-DpomFile=deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.xml",
"-DrepositoryId=space-maven",
"-Durl=" + common.space_jwm,
])

# Restore poms
with open("deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.xml", "w") as f:
f.write(pomxml)

with open("deploy/META-INF/maven/org.jetbrains.jwm/jwm-full/pom.properties", "w") as f:
f.write(pomprops)

return 0

if __name__ == "__main__":
sys.exit(main())