Skip to content

Commit

Permalink
build: update build system with alternative maven-semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
wadahiro committed Dec 20, 2024
1 parent 8ce8684 commit 36549cb
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 45 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
cache: 'maven'
server-id: ossrh
server-username: OSSRH_JIRA_USERNAME
server-password: OSSRH_JIRA_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: OSSRH_GPG_SECRET_KEY_PASSWORD
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build with Maven
run: mvn -B package

- name: Deploy SNAPSHOT version
run: mvn -B -DskipTests deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
57 changes: 21 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,37 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Checkout sources
uses: actions/checkout@v4
with:
# Disabling shallow clone is needed for correctly determing next release with semantic release
fetch-depth: 0
persist-credentials: false

- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
cache: 'maven'
server-id: ossrh
server-username: OSSRH_JIRA_USERNAME
server-password: OSSRH_JIRA_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: OSSRH_GPG_SECRET_KEY_PASSWORD
- name: Cache for maven
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache for yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-maven-semantic-release-v4.5.0
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup semantic-release
run: |
yarn global add @conveyal/[email protected] semantic-release@15
echo "$(yarn global bin)" >> $GITHUB_PATH

- name: Test
run: mvn -B test
- name: Release
# maven-semantic-release requires "maven-settings.xml" in the workspace directory
run: |
mv ~/.m2/settings.xml maven-settings.xml
semantic-release --branch main --prepare @conveyal/maven-semantic-release \
--publish @semantic-release/github,@conveyal/maven-semantic-release \
--verify-conditions @semantic-release/github,@conveyal/maven-semantic-release \
--verify-release @conveyal/maven-semantic-release\
--use-conveyal-workflow

- name: Semantic release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 23
extra_plugins: |
@semantic-release/changelog@6
@terrestris/maven-semantic-release@2
@semantic-release/git@10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
Expand Down
36 changes: 36 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@terrestris/maven-semantic-release",
{
"mavenTarget": "deploy",
"clean": false,
"updateSnapshotVersion": true,
"settingsPath": "/home/runner/.m2/settings.xml",
"processAllModules": true
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md", "pom.xml", "**/pom.xml"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"successComment": false,
"failTitle": false
}
]
]
}

0 comments on commit 36549cb

Please sign in to comment.