Add NUC authority PR-2068 #124
This file contains 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 mod-directory | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
checks: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: Start containers | |
run: | | |
cd tools/testing | |
docker compose down -v | |
docker compose up -d &> dockerOutput.log | |
sleep 20 | |
- name: Inject github build number | |
run: | | |
# Make github run id available to gradle script via env var BUILD_NUMBER so it ends up in our module descriptor version | |
# echo "BUILD_NUMBER=${{github.run_id}}" >> $GITHUB_ENV | |
echo "BUILD_NUMBER=${{github.run_number}}" >> $GITHUB_ENV | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build integrationTest | |
build-root-directory: service | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: integration-test-results | |
path: service/build/test-results/integrationTest/ | |
- name: Upload container logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: container-logs | |
path: tools/testing/*.log | |
- name: Stop containers | |
if: always() | |
run: | | |
cd tools/testing | |
docker compose down -v | |
sleep 10 | |
- name: Upload Test Results Files | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: testLogfiles | |
path: | | |
service/build/test-results/**/*.xml | |
tools/testing/*.log | |
retention-days: 1 | |
- name: Log in to the Container registry | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }} | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# master and main | |
- name: Build and push Docker image | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# extra tags for release branch | |
- name: Build and push Docker image | |
if: ${{ contains(github.ref, 'release') }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:rc | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: delete untagged containers | |
if: always() | |
uses: actions/delete-package-versions@v5 | |
with: | |
package-name: 'mod-directory' | |
package-type: 'container' | |
min-versions-to-keep: 0 | |
delete-only-untagged-versions: 'true' | |
- name: Publish Descriptor | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }} | |
run: | | |
echo Post to public registry | |
curl -i -XPOST https://registry.reshare-dev.indexdata.com/_/proxy/modules -d @service/build/resources/main/okapi/ModuleDescriptor.json |