Skip to content

Commit

Permalink
generate settings.xml with whelk-io/maven-settings-xml-action
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanhb committed Jan 31, 2023
1 parent 1f17edd commit f0816f9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ release_perform() {
TAG="$(git describe --exact-match --tags 2>/dev/null)" || error "There's no tag on commit $COMMIT_ID"
REVISION="$(./mvnw -B -N help:evaluate -Dexpression=project.version -q -DforceStdout)"
[ -n "$REVISION" ] || error "fail to get project.version"
./mvnw -B --color=always -s .github/settings.xml -Prelease-profile deploy site-deploy
./mvnw -B --color=always -Prelease-profile deploy site-deploy
find . -type f -name "*-$REVISION.zip" -print0 | xargs -0 gh release -R "$GITHUB_REPOSITORY" create "$TAG" --prerelease --target "$COMMIT_ID"
}

Expand Down
21 changes: 0 additions & 21 deletions .github/settings.xml

This file was deleted.

21 changes: 12 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ jobs:
- 17
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}
- uses: actions/cache@v3
env:
cache-name: maven-dependencies
Expand All @@ -43,6 +39,10 @@ jobs:
restore-keys: |
${{ env.cache-name }}-${{ github.workflow }}-
${{ env.cache-name }}-
- uses: actions/setup-java@v3
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}
- name: mvnw install
run: ./mvnw -B --color=always clean install
- uses: codecov/codecov-action@v3
Expand All @@ -59,10 +59,6 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ github.event.inputs.java-version || 11 }}
- uses: actions/cache@v3
env:
cache-name: maven-dependencies
Expand All @@ -73,14 +69,21 @@ jobs:
${{ env.cache-name }}-${{ github.workflow }}-${{ hashFiles('.github/**', '**/pom.xml') }}
${{ env.cache-name }}-${{ github.workflow }}-
${{ env.cache-name }}-
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ github.event.inputs.java-version || 11 }}
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Maven Deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
version="$(./mvnw -B -N help:evaluate -Dexpression=project.version -q -DforceStdout)"
case "$version" in
*-SNAPSHOT) ./mvnw -B --color=always -s .github/settings.xml deploy ;;
*-SNAPSHOT) ./mvnw -B --color=always deploy ;;
*) printf '\e[31m%s\e[m\n' "skip deploy version '$version'" ;;
esac
- name: Before Cache
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ jobs:
release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ github.event.inputs.java-version }}
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
- uses: actions/cache@v3
env:
cache-name: maven-dependencies
Expand All @@ -53,6 +50,27 @@ jobs:
restore-keys: |
${{ env.cache-name }}-${{ github.workflow }}-
${{ env.cache-name }}-
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ github.event.inputs.java-version }}
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
- name: Generate settings.xml
uses: whelk-io/maven-settings-xml-action@v21
with:
servers: >
[{
"id": "github",
"username": "${env.GITHUB_ACTOR}",
"password": "${env.GITHUB_TOKEN}"
}, {
"id": "gpg.passphrase",
"passphrase": "${env.MAVEN_GPG_PASSPHRASE}"
}, {
"id": "ossrh",
"username": "${env.MAVEN_USERNAME}",
"password": "${env.MAVEN_PASSWORD}"
}]
- name: git config
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down

0 comments on commit f0816f9

Please sign in to comment.