Skip to content

Commit

Permalink
Merge pull request #4 from openstandia/new-build
Browse files Browse the repository at this point in the history
build: update build system with alternative maven-semantic-release
  • Loading branch information
wadahiro authored Sep 30, 2024
2 parents 4d754b9 + e3b9fbb commit b2cca5a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 46 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 "::add-path::$(yarn global bin)"

- 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
hs_err_pid*

target

.idea
*.iml
30 changes: 30 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"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"
]
}

0 comments on commit b2cca5a

Please sign in to comment.