Convert to OCI plugin #42
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: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'corretto' | |
server-id: coremedia.external.releases | |
server-username: PLUGINS_NEXUS_USER | |
server-password: PLUGINS_NEXUS_PASSWORD | |
cache: 'maven' | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
cache-dependency-path: "studio-client/pnpm-lock.yaml" | |
- name: Setup registry npm.coremedia.io | |
run: | | |
NPM_AUTH_TOKEN=$(curl -s -H "Accept: application/json" -H "Content-Type:application/json" -X PUT --data '{"name": "${{ secrets.CM_NPM_USER }}", "password": "${{ secrets.CM_NPM_READ_ONLY_PASSWORD }}"}' https://npm.coremedia.io/-/user/org.couchdb.user:${{ secrets.CM_NPM_USER }} | jq -r .token) | |
echo "::add-mask::$NPM_AUTH_TOKEN" | |
pnpm config set //npm.coremedia.io/:_authToken=$NPM_AUTH_TOKEN | |
pnpm config set @coremedia:registry=https://npm.coremedia.io | |
pnpm config set @jangaroo:registry=https://npm.coremedia.io | |
- name: Setup Git | |
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' | |
run: | | |
git config --global user.name 'coremedia-ci' | |
git config --global user.email '[email protected]' | |
- name: Install PNPM Dependencies | |
working-directory: studio-client | |
run: pnpm install | |
- name: Set Release Version | |
id: set-release-version | |
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' | |
env: | |
PLUGINS_NEXUS_USER: ${{ secrets.PLUGINS_NEXUS_USER }} | |
PLUGINS_NEXUS_PASSWORD: ${{ secrets.PLUGINS_NEXUS_PASSWORD }} | |
run: | | |
mvn --batch-mode org.codehaus.mojo:versions-maven-plugin:2.8.1:set -DremoveSnapshot -DartifactId='*' | |
release_version=$(mvn --batch-mode org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) | |
cd studio-client | |
pnpm set-version ${release_version} | |
cd .. | |
git add . | |
git commit -m "set release version: ${release_version}" | |
release_tag="v${release_version}" | |
git tag "${release_tag}" | |
echo "version=${release_version}" >> $GITHUB_OUTPUT | |
echo "tag=${release_tag}" >> $GITHUB_OUTPUT | |
git push --tags | |
- name: Output Version | |
id: output-version | |
env: | |
PLUGINS_NEXUS_USER: ${{ secrets.PLUGINS_NEXUS_USER }} | |
PLUGINS_NEXUS_PASSWORD: ${{ secrets.PLUGINS_NEXUS_PASSWORD }} | |
run: | | |
version=$(mvn --batch-mode org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
- name: Build with Pnpm | |
working-directory: studio-client | |
run: | | |
pnpm -r build | |
pnpm -r upload | |
- name: Build with Maven | |
env: | |
PLUGINS_NEXUS_USER: ${{ secrets.PLUGINS_NEXUS_USER }} | |
PLUGINS_NEXUS_PASSWORD: ${{ secrets.PLUGINS_NEXUS_PASSWORD }} | |
run: mvn --batch-mode --update-snapshots deploy |