Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release java & python on semantic release step #487

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions .github/workflows/nx-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ on:
- 'main'

jobs:
security:
permissions:
contents: read
checks: read
statuses: read
security-events: write
uses: affinidi/pipeline-security/.github/workflows/security-scanners.yml@feat/check-inherit
with:
config-path: .github/labeler.yml
secrets: inherit
release:
concurrency: release
runs-on: ubuntu-latest
Expand All @@ -24,7 +14,8 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: read
needs: ['security']
issues: write
pull-requests: write
steps:
- name: Generate token from app token #https://github.com/tibdex/github-app-token
id: generate_token
Expand All @@ -49,6 +40,37 @@ jobs:
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
scope: '@affinidi-tdk'

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: install python tools
run: |
pip install twine
pip install poetry

- name: Mint pypi token
id: mint
uses: tschm/token-mint-action@v1.0.3

- name: Install gpg secret key for java Maven
run: |
echo "${{ secrets.MAVEN_GPG_SECRET_KEY }}" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG

- name: Set up JDK for deploy to Sonatype
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_SECRET_KEY_PASSWORD

- run: npm ci
# Generate tag/changelog with semantic release
# setting parallel higher than one might cause problems with locking git repo
Expand All @@ -57,6 +79,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_SECRET_KEY_PASSWORD: ${{ secrets.MAVEN_GPG_SECRET_KEY_PASSWORD }}

publish:
concurrency: publish
runs-on: ubuntu-latest
Expand Down Expand Up @@ -101,25 +127,6 @@ jobs:
id: mint
uses: tschm/token-mint-action@v1.0.3

- name: Set version for non-js client packages
run: npx nx run-many -t set-version

- name: Install gpg secret key for java Maven
run: |
echo "${{ secrets.MAVEN_GPG_SECRET_KEY }}" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG

- name: Set up JDK for deploy to Sonatype
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_SECRET_KEY_PASSWORD

- name: build
run: |
npx nx run-many -t build --parallel=false
Expand All @@ -137,6 +144,3 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} #publib-npm expects this
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_SECRET_KEY_PASSWORD: ${{ secrets.MAVEN_GPG_SECRET_KEY_PASSWORD }}
Loading