Skip to content

Commit

Permalink
CI: Reuse built artifacts in publish jobs (sonatype, github)
Browse files Browse the repository at this point in the history
This should avoid duplicated build work.
It aslo makes sure, we publish identical jars everywhere.
Potentially needed GHA Job retries will be faster too.

This is untested. We should do at least one manual run before we tag the next release.
  • Loading branch information
lefou committed Nov 4, 2024
1 parent 692c0dd commit c66db6e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,33 @@ concurrency:
cancel-in-progress: true

jobs:
build-artifacts:
# when in master repo, publish all tags and manual runs on main
if: github.repository == 'com-lihaoyi/mill'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}

- uses: coursier/cache-action@v6

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin

- run: ./mill -i __.publishArtifacts

- uses: actions/[email protected]
with:
path: .
include-hidden-files: true

publish-sonatype:
# when in master repo, publish all tags and manual runs on main
if: github.repository == 'com-lihaoyi/mill'
needs: build-artifacts
runs-on: ubuntu-latest

# only run one publish job for the same sha at the same time
Expand All @@ -40,8 +64,10 @@ jobs:
LC_ALL: "en_US.UTF-8"

steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: actions/download-artifact@v4
if: ${{ !inputs.populate_cache }}
with:
path: .

- uses: coursier/cache-action@v6

Expand All @@ -62,8 +88,10 @@ jobs:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}

steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: actions/download-artifact@v4
if: ${{ !inputs.populate_cache }}
with:
path: .

- uses: coursier/cache-action@v6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-mill-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Run Mill '${{ inputs.millargs }}'
# Mill tests are pretty heavy so run them only 3x parallel on 4 core Github Actions runners
run: ./mill -i -j3 -k ${{ inputs.millargs }}
run: ./mill -i -j3 -k ${{ inputs.millargs }}
if: inputs.millargs != '' && !startsWith(inputs.os, 'windows')

- name: Run Mill (on Windows) '${{ inputs.millargs }}'
Expand Down

0 comments on commit c66db6e

Please sign in to comment.