Skip to content

Commit 5160689

Browse files
Refactor workflows
1 parent d4f8d5b commit 5160689

File tree

4 files changed

+22
-105
lines changed

4 files changed

+22
-105
lines changed

.github/PUBLISHING.md

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,4 @@
11
# Publishing
22

3-
## Prerequisites
4-
5-
> Both methods can be mixed because if a variable is not found, it will try to get it using the
6-
> another method.
7-
8-
### Using Gradle properties method
9-
10-
> It is recommended to set the next properties in the `$home/.gradle/gradle.properties` file instead
11-
> of using the project `gradle.properties`.
12-
>
13-
> Another alternative is setting them via CLI, i.e.:
14-
> `./gradlew -P"signing.gnupg.keyName"="[keyName]"`.
15-
16-
1. Generate key: `gpg --full-generate-key`
17-
2. Check key name: `gpg --list-signatures`
18-
3. Upload to server: `gpg --keyserver hkps://keys.openpgp.org --send-keys [keyName]`
19-
4. Show the private key: `gpg --armor --export-secret-keys [keyName]`
20-
5. Add Nexus user: `oss.user=[user]`
21-
6. Add Nexus token: `oss.token=[token]`
22-
7. Add Nexus profileId: `oss.stagingProfileId=[stagingProfileId]`
23-
1. Visit this [link](https://oss.sonatype.org/#stagingProfiles), select your profile and copy
24-
`SOME_NUMBER` from the url `https://oss.sonatype.org/#stagingProfiles;SOME_NUMBERS`
25-
8. Add KeyName (optional with `useInMemoryPgpKeys`): `signing.gnupg.keyName=[keyName]`
26-
9. Add KeyId (optional with `useInMemoryPgpKeys` and `useCpgCmd`): `signing.gnupg.keyId=[keyId]`
27-
10. Add Key (replace line breaks with `\n`, optional with `useGpgCmd`): `signing.gnupg.key=[key]`
28-
11. Add Passphrase: `signing.gnupg.passphrase=[passphrase]`
29-
30-
### Using environment variables method
31-
32-
1. Generate key: `gpg --full-generate-key`
33-
2. Check key id: `gpg --list-signatures`
34-
3. Upload to server: `gpg --keyserver hkps://keys.openpgp.org --send-keys [keyId]`
35-
4. Add Nexus user: `OSS_USER`
36-
5. Add Nexus token: `OSS_TOKEN`
37-
6. Add Nexus profileId: `OSS_STAGING_PROFILE_ID`
38-
1. Visit this [link](https://oss.sonatype.org/#stagingProfiles), select your profile and copy
39-
`SOME_NUMBER` from the url `https://oss.sonatype.org/#stagingProfiles;SOME_NUMBERS`
40-
7. Add KeyName (optional with `useInMemoryPgpKeys`): `SIGNING_KEY_NAME=[keyName]`
41-
8. Add KeyId (optional with `useInMemoryPgpKeys` and `useCpgCmd`): `SIGNING_KEY_ID=[keyId]`
42-
9. Add Key (replace line breaks with `\n`, optional with `useGpgCmd`): `SIGNING_KEY=[key]`
43-
1. If it is used as secret in GitHub, it is not necessary to replace all line breaks with `\n`
44-
10. Add Passphrase: `SIGNING_KEY_PASSPHRASE=[passphrase]`
45-
46-
### Minimum amount of secrets for publishing via GitHub Actions
47-
48-
- With `useInMemoryPgpKeys` (used by default):
49-
50-
1. `OSS_USER`
51-
2. `OSS_TOKEN`
52-
3. `OSS_STAGING_PROFILE_ID`
53-
4. `SIGNING_KEY_PASSPHRASE`
54-
5. `SIGNING_KEY`
55-
6. `SIGNING_KEY_ID` (optional)
56-
57-
- With `useCpgCmd` (if the previous method fails, this will be used):
58-
59-
1. `OSS_USER`
60-
2. `OSS_TOKEN`
61-
3. `OSS_STAGING_PROFILE_ID`
62-
4. `SIGNING_KEY_NAME`
63-
5. `SIGNING_KEY_PASSPHRASE`
64-
6. `SIGNING_KEY`
65-
66-
> You can use these utilities:
67-
> - Kleopatra, GUI for Windows
68-
> - GPG Suite (GPGTools), GUI for macOS
69-
> - `crazy-max/ghaction-import-gpg` action to import the GPG key.
70-
71-
## Publish the artifacts
72-
73-
`useInMemoryPgpKeys` will be used by the default, if it crashes, `useGpgCmd` will be used.
74-
75-
### Snapshot
76-
77-
The version should end with `-SNAPSHOT`
78-
79-
```
80-
./gradlew publishToSonatype -P"reckon.stage"="snapshot"
81-
```
82-
83-
### Release
84-
85-
```
86-
./gradlew publishToSonatype -P"reckon.stage"="[stage]" -P"reckon.scope"="[scope]"
87-
```
3+
Check [publishing](https://github.com/JavierSegoviaCordoba/gradle-plugins/blob/main/.github/PUBLISHING.md)
4+
from [JavierSC Gradle plugins](https://github.com/JavierSegoviaCordoba/gradle-plugins/)

.github/workflows/build-kotlin-dispatcher.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
machines:
7-
description: 'Virtual environment, default is `ubuntu-latest`. The first one will be used for one global time steps.'
7+
description: 'Virtual environments'
88
default: 'macos-latest, ubuntu-latest, windows-latest'
99
required: true
1010
gradle-args:
@@ -14,7 +14,6 @@ on:
1414

1515
jobs:
1616
build:
17-
if: ${{ github.event_name == 'workflow_dispatch' }}
1817
uses: JavierSegoviaCordoba/reusable-workflows/.github/workflows/build-kotlin.yaml@main
1918
with:
2019
machines: '${{ github.event.inputs.machines }}'

.github/workflows/build-kotlin.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515

1616
jobs:
1717
build:
18-
if: ${{ github.event_name != 'workflow_dispatch' }}
1918
uses: JavierSegoviaCordoba/reusable-workflows/.github/workflows/build-kotlin.yaml@main
2019
with:
2120
machines: 'macos-latest, ubuntu-latest, windows-latest'

.github/workflows/generate-version-tag.yaml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@ name: generate-version-tag
22

33
on:
44
workflow_dispatch:
5-
if: |
6-
github.ref == 'refs/heads/main' ||
7-
!contains(github.ref, 'SNAPSHOT') &&
8-
github.event.inputs.scope = 'mayor' ||
9-
github.event.inputs.scope = 'minor' ||
10-
github.event.inputs.scope = 'patch' ||
11-
github.event.inputs.scope = '' &&
12-
github.event.inputs.stage = 'alpha' ||
13-
github.event.inputs.stage = 'beta' ||
14-
github.event.inputs.stage = 'rc' ||
15-
github.event.inputs.stage = 'final'
16-
5+
if: github.ref == 'refs/heads/main'
176
inputs:
187
stage:
19-
description: 'Stage, one of [alpha, beta, rc, final]'
20-
default: 'alpha'
8+
description: 'Stage'
219
required: true
10+
default: 'auto'
11+
type: choice
12+
options:
13+
- 'alpha'
14+
- 'beta'
15+
- 'rc'
16+
- 'final'
17+
- 'auto'
2218
scope:
23-
description: 'Scope one of [mayor, minor, patch] or empty'
24-
default: ''
25-
required: false
19+
description: 'Scope'
20+
required: true
21+
default: 'auto'
22+
type: choice
23+
options:
24+
- 'patch'
25+
- 'minor'
26+
- 'major'
27+
- 'auto'
2628

2729
jobs:
2830
generate:

0 commit comments

Comments
 (0)