Skip to content

Commit

Permalink
CI: Reuse built artifacts in publish jobs (sonatype, github) (#3904)
Browse files Browse the repository at this point in the history
This should avoid duplicated build work.
It also 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.

Pull request: #3904
  • Loading branch information
lefou authored Nov 4, 2024
1 parent 96c4057 commit acb5e0f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
34 changes: 30 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/upload-artifact@v4.4.3
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,9 @@ jobs:
LC_ALL: "en_US.UTF-8"

steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: actions/download-artifact@v4
with:
path: .

- uses: coursier/cache-action@v6

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

steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: actions/download-artifact@v4
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 acb5e0f

Please sign in to comment.