-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple publish/releasing from main CI (#3483)
By the time things passed tests and land in master, they have already passed tests twice (once on PR, once in master). So no need to run tests a third time when we push a tag or manually trigger a release
- Loading branch information
Showing
3 changed files
with
87 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Publish Artifacts | ||
|
||
# Tags are automatically published | ||
# | ||
# Manual publishing (workflow_dispatch) from the main branch is also supported | ||
# | ||
# Separate from main test running, because we assume that anything you push a | ||
# tag for or trigger manually would already have passed tests, so no need to run | ||
# them again and deal with slowness and flakiness twice. | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '**' | ||
pull_request: | ||
merge_group: | ||
workflow_dispatch: | ||
|
||
# cancel older runs of a pull request; | ||
# this will not cancel anything for normal git pushes | ||
concurrency: | ||
group: cancel-old-pr-runs-${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish-sonatype: | ||
# when in master repo, publish all tags and manual runs on main | ||
if: github.repository == 'com-lihaoyi/mill' && (startsWith( github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' ) ) | ||
runs-on: ubuntu-latest | ||
|
||
# only run one publish job for the same sha at the same time | ||
# e.g. when a main-branch push is also tagged | ||
concurrency: publish-sonatype-${{ github.sha }} | ||
|
||
env: | ||
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_SECRET }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_DEPLOY_USER }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_DEPLOY_PASSWORD }} | ||
SONATYPE_PGP_PASSWORD: ${{ secrets.SONATYPE_PGP_PASSWORD }} | ||
LANG: "en_US.UTF-8" | ||
LC_MESSAGES: "en_US.UTF-8" | ||
LC_ALL: "en_US.UTF-8" | ||
|
||
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: ci/release-maven.sh | ||
|
||
release-github: | ||
# when in master repo, publish all tags and manual runs on main | ||
if: github.repository == 'com-lihaoyi/mill' && (startsWith( github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' ) ) | ||
needs: publish-sonatype | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
|
||
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 uploadToGithub $REPO_ACCESS_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters