Skip to content

Publish packages to sonatype #37

Publish packages to sonatype

Publish packages to sonatype #37

Workflow file for this run

name: "Release scala-libs"
on:
pull_request:
types: [opened, edited, synchronize]
env:
SERVICES: '["http", "fixtures"]'
permissions:
id-token: write
issues: write
pull-requests: write
actions: write
jobs:
matrix-config:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.prepare.outputs.matrix }}
steps:
- name: Prepare matrix JSON Object
id: prepare
run: echo 'matrix=${{ env.SERVICES }}' >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: matrix-config
strategy:
matrix:
name: ${{ fromJSON(needs.matrix-config.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GHA_SCALA_LIBS_ROLE_ARN }}
- uses: aws-actions/amazon-ecr-login@v2
- name: Run sbt tests
run: ./builds/run_sbt_tests.sh ${{ matrix.name }}
report-evictions:
runs-on: ubuntu-latest
needs: matrix-config
strategy:
matrix:
name: ${{ fromJSON(needs.matrix-config.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GHA_SCALA_LIBS_ROLE_ARN }}
- uses: aws-actions/amazon-ecr-login@v2
- name: Run eviction report for ${{ matrix.name }}
run: ./builds/report_sbt_evictions.sh ${{ matrix.name }}
continue-on-error: true
- name: Upload eviction reports
if: always() # This ensures it runs even if the previous step fails
uses: actions/upload-artifact@v4
with:
name: evicted_${{ matrix.name }}
path: .reports/evicted_${{ matrix.name }}
collate-evictions:
runs-on: ubuntu-latest
needs: report-evictions
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download eviction reports
uses: actions/download-artifact@v4
with:
path: .reports/
- name: Collate evictions
run: |
ls -la
ls -la .reports
ls -la .reports/evicted_fixtures
mkdir -p .reports
builds/report_unique_evictions.sh | tee unique_evictions.txt
- name: Post eviction report comment
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const reportContent = fs.readFileSync('unique_evictions.txt', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: reportContent
});