Publish snapshots #158
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Publish snapshots | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| publish-maven-snapshot: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| server-id: github | |
| settings-path: ${{ github.workspace }} | |
| cache: 'maven' | |
| - name: Get version | |
| run: echo project_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_ENV | |
| - name: Append "-SNAPSHOT" to projects version | |
| run: mvn versions:set "-DnewVersion=${{ env.project_version }}-SNAPSHOT" | |
| - name: Publish to GitHub Packages Apache Maven | |
| run: mvn -B --no-transfer-progress deploy -s $GITHUB_WORKSPACE/settings.xml | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| publish-npm-snapshot: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| server-id: github | |
| settings-path: ${{ github.workspace }} | |
| cache: 'maven' | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 18 | |
| registry-url: https://npm.pkg.github.com | |
| - name: Get version | |
| run: echo project_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_ENV | |
| - name: Get short commit hash | |
| run: echo commit=$(git rev-parse --short HEAD) >> $GITHUB_ENV | |
| - name: Append commit hash to projects version | |
| run: mvn versions:set "-DnewVersion=${{ env.project_version }}-${{ env.commit }}" | |
| - name: Build with Maven | |
| run: mvn -B --no-transfer-progress package --file pom.xml | |
| - name: Install dependencies | |
| working-directory: ./target/generated-sources/openapi/axios | |
| run: npm install | |
| - name: Publish npm package | |
| working-directory: ./target/generated-sources/openapi/axios | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |