diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1302a64..791f374 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,13 +54,15 @@ jobs: path: | modules/federation-server/build/libs/federation-server-*.jar modules/admin-server/build/libs/admin-server-*.jar - tag-version: + docker-publish: needs: gradle runs-on: ubuntu-latest if: github.event_name == 'repository_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'push' && needs.gradle.outputs.success == 'true') + timeout-minutes: 20 permissions: contents: write actions: write + packages: write steps: - name: Checkout repository uses: actions/checkout@v4 @@ -103,4 +105,78 @@ jobs: git tag -a ${NEW_VERSION} -m "Release ${NEW_VERSION}" git push origin ${NEW_VERSION} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: ./ + + - name: Create directory structure and move artifacts + run: | + mkdir -p modules/federation-server/build/libs/ + mkdir -p modules/admin-server/build/libs/ + mv ./federation-server/build/libs/federation-server-*.jar modules/federation-server/build/libs/ + mv ./admin-server/build/libs/admin-server-*.jar modules/admin-server/build/libs/ + chmod 644 modules/federation-server/build/libs/*.jar + chmod 644 modules/admin-server/build/libs/*.jar + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata (federation-server) + id: meta-federation + uses: docker/metadata-action@v5 + with: + images: sphereon/openid-federation-server + tags: | + type=raw,value=${{ steps.get_version_info.outputs.new_version }} + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}},value=${{ steps.get_version_info.outputs.new_version }} + type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version_info.outputs.new_version }} + type=semver,pattern={{major}},value=${{ steps.get_version_info.outputs.new_version }} + + - name: Build and push federation-server + uses: docker/build-push-action@v5 + with: + context: . + file: ./.docker/federation-server/Dockerfile + push: true + tags: ${{ steps.meta-federation.outputs.tags }} + labels: ${{ steps.meta-federation.outputs.labels }} + cache-from: | + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-server:latest + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:latest + - name: Extract metadata (admin-server) + id: meta-admin + uses: docker/metadata-action@v5 + with: + images: sphereon/openid-federation-admin-server + tags: | + type=raw,value=${{ steps.get_version_info.outputs.new_version }} + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}},value=${{ steps.get_version_info.outputs.new_version }} + type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version_info.outputs.new_version }} + type=semver,pattern={{major}},value=${{ steps.get_version_info.outputs.new_version }} + + - name: Build and push admin-server + uses: docker/build-push-action@v5 + with: + context: . + file: ./.docker/admin-server/Dockerfile + push: true + tags: ${{ steps.meta-admin.outputs.tags }} + labels: ${{ steps.meta-admin.outputs.labels }} + cache-from: | + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:latest + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:latest + cache-to: | + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:latest,mode=max + type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:latest,mode=max \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 57f01ff..d491974 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -93,7 +93,7 @@ fun getNpmVersion(): String { allprojects { group = "com.sphereon.oid.fed" - version = "0.3.11-SNAPSHOT" + version = "0.3.12-SNAPSHOT" val npmVersion by extra { getNpmVersion() } // Common repository configuration for all projects