-
-
Notifications
You must be signed in to change notification settings - Fork 374
159 lines (130 loc) · 4.74 KB
/
publish-artifacts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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:
tags:
- '**'
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:
build-artifacts:
# when in master repo, publish all tags and manual runs on main
if: github.repository == 'com-lihaoyi/mill'
runs-on: ubuntu-latest
env:
MILL_STABLE_VERSION: 1
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
name: publish-artifacts
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
# e.g. when a main-branch push is also tagged
concurrency: publish-sonatype-${{ github.sha }}
env:
MILL_STABLE_VERSION: 1
MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MILL_PGP_SECRET_BASE64: ${{ secrets.SONATYPE_PGP_SECRET }}
MILL_PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PASSWORD }}
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
steps:
- uses: actions/download-artifact@v4
with:
path: .
name: publish-artifacts
- run: ls -la .
# Need to fix cached artifact file permissions because github actions screws it up
# https://github.com/actions/upload-artifact/issues/38
# Best is, we restore any file to avoid any changes
- run: git reset --hard
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: ./mill -i mill.scalalib.PublishModule/
publish-sonatype-native:
# when in master repo, publish all tags and manual runs on main
if: github.repository == 'com-lihaoyi/mill'
runs-on: ${{ matrix.os }}
# 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-native-${{ matrix.os }}-${{ github.sha }}
strategy:
matrix:
include:
- os: macos-latest
coursierarchive: ""
- os: windows-latest
coursierarchive: C:/coursier-arc
# Skip this because the main publishing job handles it
# - os: ubuntu-latest
env:
MILL_STABLE_VERSION: 1
MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MILL_PGP_SECRET_BASE64: ${{ secrets.SONATYPE_PGP_SECRET }}
MILL_PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PASSWORD }}
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
COURSIER_ARCHIVE_CACHE: ${{ matrix.coursierarchive }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: ./mill -i mill.scalalib.PublishModule/ --publishArtifacts dist.native.publishArtifacts
release-github:
# when in master repo, publish all tags and manual runs on main
if: github.repository == 'com-lihaoyi/mill'
needs: publish-sonatype
runs-on: ubuntu-latest
env:
MILL_STABLE_VERSION: 1
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
steps:
- uses: actions/download-artifact@v4
with:
path: .
name: publish-artifacts
- run: ls -la .
# Need to fix cached artifact file permissions because github actions screws it up
# https://github.com/actions/upload-artifact/issues/38
# Best is, we restore any file to avoid any changes
- run: git reset --hard
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: ./mill -i dist.uploadToGithub --authKey $REPO_ACCESS_TOKEN