Publish packages #718
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: Publish packages | |
| on: | |
| workflow_run: | |
| workflows: [Bump version] | |
| branches: [main] | |
| types: [completed] | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| workflow_dispatch: | |
| env: | |
| WORKFLOW_OUT_DIR: ./workflow-outputs | |
| jobs: | |
| publish-packages: | |
| name: ${{ github.event_name == 'pull_request' && 'Test publishing packages' || 'Publish packages' }} | |
| env: | |
| JDK_VERSION: 21 | |
| GITHUB_ACTOR: ${{ secrets.MODULE_FETCH_TOKEN_USERNAME}} | |
| GITHUB_TOKEN: ${{ secrets.MODULE_FETCH_TOKEN }} | |
| permissions: | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Run checkout github action | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| lfs: 'true' | |
| submodules: 'true' | |
| fetch-depth: 0 | |
| - name: Download bump-version outputs | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e #v4.2.1 | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| with: | |
| name: bump-version-outputs | |
| path: ${{ env.WORKFLOW_OUT_DIR }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Enable publishing if triggered manually | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| run: echo "should_publish=true" >> "$GITHUB_ENV" | |
| - name: Enable publishing if version was bumped | |
| run: | | |
| if [ -f "$WORKFLOW_OUT_DIR/bump-version.yml" ]; then | |
| version_bumped=$(yq ".version-bumped" "$WORKFLOW_OUT_DIR/bump-version.yml") | |
| echo "should_publish=$version_bumped" >> "$GITHUB_ENV" | |
| fi | |
| - name: Setup GitHub Runner workflow | |
| uses: ./mobile-android-pipelines/actions/setup-runner | |
| with: | |
| jdk-version: 21 | |
| - name: Cache mobile-android-pipelines build | |
| uses: ./actions/cache-pipelines-build | |
| - name: Publish to Github Packages | |
| if: ${{ github.event_name != 'pull_request' && env.should_publish == 'true' }} | |
| uses: ./mobile-android-pipelines/actions/maven-publish | |
| with: | |
| GITHUB_ACTOR: ${{ secrets.MODULE_FETCH_TOKEN_USERNAME}} | |
| GITHUB_TOKEN: ${{ secrets.MODULE_FETCH_TOKEN }} | |
| - name: Test publishing to Maven local | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: ./mobile-android-pipelines/actions/maven-publish-local | |
| with: | |
| expected-packages: ' | |
| uk.gov.onelogin.criorchestrator.features:resume-internal, | |
| uk.gov.onelogin.criorchestrator.features:resume-internal-api, | |
| uk.gov.onelogin.criorchestrator.features:resume-public-api, | |
| uk.gov.onelogin.criorchestrator.features:select-doc-internal, | |
| uk.gov.onelogin.criorchestrator.features:select-doc-internal-api, | |
| uk.gov.onelogin.criorchestrator.libraries:analytics, | |
| uk.gov.onelogin.criorchestrator.libraries:di, | |
| uk.gov.onelogin.criorchestrator.libraries:screenshot-testing, | |
| uk.gov.onelogin.criorchestrator.sdk:sdk, | |
| uk.gov.onelogin.criorchestrator.sdk:sdk-internal, | |
| uk.gov.onelogin.criorchestrator.sdk:sdk-shared-api' | |
| GITHUB_ACTOR: ${{ secrets.MODULE_FETCH_TOKEN_USERNAME}} | |
| GITHUB_TOKEN: ${{ secrets.MODULE_FETCH_TOKEN }} | |
| - name: Clean workspace | |
| uses: ./mobile-android-pipelines/actions/clean-workspace |