Skip to content

Commit

Permalink
fix: make dockerhub push listen for new tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Jan 16, 2025
1 parent 7899a32 commit 76d3d05
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 3 deletions.
80 changes: 78 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76d3d05

Please sign in to comment.