Skip to content

build: generateJsSourcesFromJvmResources dependencies #55

build: generateJsSourcesFromJvmResources dependencies

build: generateJsSourcesFromJvmResources dependencies #55

Workflow file for this run

name: release
on:
workflow_call:
workflow_dispatch:
push:
branches:
- master
jobs:
check-secrets:
environment: release_env
runs-on: ubuntu-22.04
outputs:
run-with-secrets: ${{ steps.require-secrets.outputs.run-with-secrets }}
steps:
- name: Find if secrets are available
id: detect-secrets
uses: DanySK/are-secrets-available@1.0.0
with:
secrets: ${{ toJson(secrets) }}
- name: Set condition
id: require-secrets
run: |
echo "run-with-secrets=${{ steps.detect-secrets.outputs.has-secrets == 'true' && !github.event.repository.fork }}" >> $GITHUB_OUTPUT
staging-repo:
environment: release_env
runs-on: ubuntu-22.04
needs:
- check-secrets
concurrency:
group: staging-repo-${{ github.workflow }}-${{ github.event.number || github.ref }}
if: needs.check-secrets.outputs.run-with-secrets == 'true'
outputs:
maven-central-repo-id: ${{ steps.staging-repo.outputs.MavenCentral }}
next-version: ${{ steps.compute-next-version.outputs.next-version }}
will-release: ${{ steps.compute-next-version.outputs.will-release }}
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0
- name: Compute next release version
id: compute-next-version
uses: nicolasfara/precompute-semantic-release-version-action@2.0.1
with:
github-token: ${{ github.token }}
# - name: Setup Nodejs
# uses: actions/setup-node@v4.0.3
# with:
# node-version-file: ./package.json
# - name: Install Dependecies
# working-directory: .
# run: npm ci
# shell: bash
# - name: Next Version
# id: compute-next-version
# run: |
# mv release.config.mjs base.js
# mv pre-release.config.mjs release.config.mjs
# npx semantic-release --extends=./base.js --dry-run --no-ci
# if [[ -s .next-version ]]; then
# echo "New release will be triggered: $(cat .next-version)"
# echo "will-release=true" >> $GITHUB_OUTPUT
# echo "next-version=$(cat .next-version)" >> $GITHUB_OUTPUT
# else
# echo "No release will be triggered"
# echo "will-release=false" >> $GITHUB_OUTPUT
# fi
# mv base.js release.config.mjs
- uses: DanySK/build-check-deploy-gradle-action@2.4.22
with:
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
maven-central-username: ${{ secrets.MAVEN_USERNAME }}
should-run-codecov: false
should-deploy: true
build-command: true
check-command: true
deploy-command: |
if [[ "${{ steps.compute-next-version.outputs.will-release }}" == "true" ]]; then
./gradlew -PforceVersion="${{ steps.compute-next-version.outputs.next-version }}" createStagingRepositoryOnMavenCentral --parallel
else
./gradlew createStagingRepositoryOnMavenCentral --parallel
fi
- name: Save staging repository ID
id: staging-repo
run: |
[[ -f build/staging-repo-ids.properties ]] || (
echo "Staging repositories ID file not found" &&
exit 1
)
REPO_IDS=$(cat build/staging-repo-ids.properties)
echo "Staging repositories IDs:\n$REPO_IDS"
echo $REPO_IDS >> $GITHUB_OUTPUT
build:
environment: release_env
needs:
- check-secrets
- staging-repo
if: always() && !contains(needs.staging-repo.result, 'failure')
# Uncomment if cross-compilation is needed
# strategy:
# fail-fast: false
# matrix:
# os: [ windows-2022, macos-12, ubuntu-22.04 ]
# runs-on: ${{ matrix.os }}
# Comment if cross-compilation is needed
runs-on: ubuntu-22.04
concurrency:
group: build-${{ github.workflow }}-${{ matrix.os }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
steps:
- name: Checkout
uses: DanySK/action-checkout@0.2.19
- uses: DanySK/build-check-deploy-gradle-action@2.4.22
timeout-minutes: 120
with:
# Dry-deployment
deploy-command: |
./gradlew assemble --continue || ./gradlew assemble --continue
NEXT_VERSION="${{ needs.staging-repo.outputs.next-version }}"
OVERRIDE_VERSION=$([[ "$NEXT_VERSION" != "" ]] && echo "-PforceVersion=$(echo $NEXT_VERSION)" || echo "")
./gradlew $OVERRIDE_VERSION -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} uploadProject --parallel
should-run-codecov: false
should-deploy: ${{ contains(needs.staging-repo.result, 'success') }}
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
maven-central-username: ${{ secrets.MAVEN_USERNAME }}
build-command: |
SKIP_DOC="-x dokkaHtml -x javadoc -x dokkaJavadoc -x dokkaGfm -x dokkaJekyll"
./gradlew assemble $SKIP_DOC --parallel || ./gradlew assemble $SKIP_DOC --parallel
check-command: true
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
close-staging-repos:
environment: release_env
needs:
- staging-repo
- build
runs-on: ubuntu-22.04
if: |
always() &&
needs.check-secrets.outputs.run-with-secrets == 'true' &&
needs.build.result == 'success'
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
- uses: DanySK/build-check-deploy-gradle-action@2.4.22
with:
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
maven-central-username: ${{ secrets.MAVEN_USERNAME }}
should-run-codecov: false
should-deploy: true
build-command: true
check-command: true
deploy-command: |
./gradlew -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} close --parallel
if [[ "${{ needs.staging-repo.outputs.will-release }}" == "false" ]]; then
./gradlew -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} drop
fi
release:
environment: release_env
concurrency:
# Only one release job at a time per branch, as only master releases.
# Strictly sequential.
group: release-${{ github.event.number || github.ref }}
needs:
- check-secrets
- staging-repo
- build
- close-staging-repos
runs-on: ubuntu-22.04
if: |
always() &&
needs.check-secrets.outputs.run-with-secrets == 'true' &&
needs.close-staging-repos.result == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
with:
token: ${{ secrets.ARG2P_CI_GITHUB_TOKEN }}
- name: Find the version of Node from package.json
id: node-version
run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT
- name: Install Node
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ steps.node-version.outputs.version }}
- uses: DanySK/build-check-deploy-gradle-action@2.4.22
env:
STAGING_REPO_ID: ${{ needs.staging-repo.outputs.maven-central-repo-id }}
ENFORCE_VERSION: "${{ needs.staging-repo.outputs.next-version }}"
with:
build-command: |
NEXT_VERSION="${{ needs.staging-repo.outputs.next-version }}"
OVERRIDE_VERSION=$([[ "$NEXT_VERSION" != "" ]] && echo "-PforceVersion=$(echo $NEXT_VERSION)" || echo "")
./gradlew $OVERRIDE_VERSION shadowJar
./gradlew $OVERRIDE_VERSION dokkaHtmlMultiModuleZip
check-command: true
deploy-command: |
npm install
npx semantic-release
should-run-codecov: false
should-deploy: true
github-token: ${{ github.token }}
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
maven-central-username: ${{ secrets.MAVEN_USERNAME }}
npm-token: ${{ secrets.NPM_TOKEN }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
success:
runs-on: ubuntu-22.04
needs:
- check-secrets
- staging-repo
- close-staging-repos
- release
- build
if: >-
always() && (
contains(join(needs.*.result, ','), 'failure')
|| !contains(join(needs.*.result, ','), 'cancelled')
)
steps:
- name: Verify that there were no failures
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}