v3.3.0 #27
Workflow file for this run
This file contains 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-maven-and-nuget | |
on: | |
release: | |
types: [created] | |
jobs: | |
release-java: | |
#if: ${{ false }} # disable for now | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: java | |
steps: | |
- name: Checkout GitHub repo | |
uses: actions/checkout@v4 | |
#Official documentation seems incomplete. To avoid failure when importing key: | |
#https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions | |
#It requires export the private key with the armor option: gpg --output private.pgm --armor --export-secret-key <email> | |
- name: Import GPG Key | |
uses: crazy-max/ghaction-import-gpg@v6.2.0 | |
with: | |
gpg_private_key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@v4 | |
with: # running setup-java again overwrites the settings.xml | |
distribution: 'temurin' | |
java-version: '11' | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: MAVEN_USERNAME # env variable for username in deploy | |
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | |
- name: Publish to Apache Maven Central | |
run: mvn deploy -P publish-maven --no-transfer-progress -DskipTests=true | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
release-net: | |
#if: ${{ false }} # disable for now | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: net | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4.2.0 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Pack | |
run: dotnet pack --configuration Release Selema/Selema.csproj | |
#- name: Push to GitHub packages | |
# run: | | |
# dotnet nuget add source --username javiertuya --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/javiertuya/index.json" | |
# dotnet nuget push Selema/nupkg/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to nuget.org | |
run: dotnet nuget push Selema/nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source "https://api.nuget.org/v3/index.json" | |
#- name: Push to int.nugettest.org | |
# run: dotnet nuget push Selema/nupkg/*.nupkg --api-key ${{ secrets.NUGETTEST_API_KEY }} --source "https://apiint.nugettest.org/v3/index.json" |