Skip to content

Commit

Permalink
Upload native launcher to GitHub release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Jun 8, 2023
1 parent 4f8b7b0 commit 4b7781f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,58 @@ jobs:
env:
UPLOAD_GH_TOKEN: ${{ secrets.GH_TOKEN }}

build-native-launchers:
runs-on: ${{ matrix.OS }}
strategy:
fail-fast: false
matrix:
OS: [ubuntu-latest, macos-latest]
steps:
- name: Don't convert LF to CRLF during checkout
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: coursier/[email protected]
- uses: coursier/[email protected]
with:
jvm: 8
apps:
- name: Copy launcher
run: ./mill -i ci.copyNativeLauncher artifacts/
- uses: actions/upload-artifact@v3
with:
name: native-launchers
path: artifacts/
if-no-files-found: error
retention-days: 2

upload-native-launchers:
needs: build-native-launchers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: coursier/[email protected]
- uses: coursier/[email protected]
with:
jvm: 8
- uses: actions/download-artifact@v3
with:
name: launchers
path: artifacts/
- run: ./mill -i ci.uploadNativeLaunchers
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
env:
UPLOAD_GH_TOKEN: ${{ secrets.GH_TOKEN }}

update-docker-images:
needs: release
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,20 @@ object ci extends Module {
)
}

def uploadNativeLaunchers(directory: String = "artifacts", almondVersion: String = buildVersion) =
T.command {
def ghToken() = Option(System.getenv("UPLOAD_GH_TOKEN")).getOrElse {
sys.error("UPLOAD_GH_TOKEN not set")
}
val launchers = os.list(os.Path(directory, os.pwd)).map(p => (p, p.last))
val (tag, overwriteAssets) =
if (almondVersion.endsWith("-SNAPSHOT")) ("nightly", true)
else ("v" + almondVersion, false)
Upload.upload(ghOrg, ghName, ghToken(), tag, dryRun = false, overwrite = overwriteAssets)(
launchers: _*
)
}

def copyNativeLauncher(directory: String = "artifacts") = T.command {
val nativeLauncher = scala.launcher.image.nativeImage().path
Upload.copyLauncher(
Expand Down

0 comments on commit 4b7781f

Please sign in to comment.