Skip to content

Publish to Maven Repo #126

Publish to Maven Repo

Publish to Maven Repo #126

Workflow file for this run

name: Publish to Maven Repo
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
registry_package:
types:
- published
concurrency:
group: maven
cancel-in-progress: true
env:
VERSION: "${{ github.event.inputs.version || github.event.registry_package.package_version.name }}"
jobs:
publish:
name: Publish to Maven Repo
if: "github.repository_owner == 'mollyim'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: mollyim/maven
ref: master
token: ${{ secrets.PUBLISH_PAT }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Download library from GitHub Packages
run: |
mvn dependency:get \
-DremoteRepositories=github::::https://maven.pkg.github.com/mollyim/ringrtc \
-Dtransitive=false \
-Dartifact="im.molly:ringrtc-android:$VERSION:pom"
mvn dependency:get \
-DremoteRepositories=github::::https://maven.pkg.github.com/mollyim/ringrtc \
-Dtransitive=false \
-Dartifact="im.molly:ringrtc-android:$VERSION:aar"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy library to Maven repo
run: |
cp -av "$HOME/.m2/repository/im/molly/ringrtc-android/$VERSION/" out/
mvn -B deploy:deploy-file \
-DgroupId=im.molly \
-DartifactId=ringrtc-android \
-Dversion="$VERSION" \
-Dfile="out/ringrtc-android-$VERSION.aar" \
-DpomFile="out/ringrtc-android-$VERSION.pom" \
-Durl="file://$PWD/ringrtc/releases"
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -v ringrtc
git commit -m "ringrtc $VERSION"
git push origin master