diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e21d04d..c2e08b8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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 }} \ No newline at end of file + OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed1f3df..5cdac27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/maven-semantic-release@v4.5.0 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 }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..66ff0c5 --- /dev/null +++ b/.releaserc @@ -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 + } + ] + ] +}