Skip to content

Publish

Publish #6

Workflow file for this run

# Workflow for publishing the artifacts once a GitHub release is published
name: Publish
on:
release:
types: [published]
jobs:
push-simulator:
name: Push Simulator to DockerHub
runs-on: ubuntu-22.04
steps:
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/atlarge-research/opendc
VERSION=3.0-SNAPSHOT
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v5
with:
push: true
file: opendc-web/opendc-web-runner/Dockerfile
tags: ${{ steps.prep.outputs.tags }}
push-api:
name: Push API to DockerHub
runs-on: ubuntu-22.04
steps:
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/atlarge-research/opendc-web-api
VERSION=3.0-SNAPSHOT
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v5
with:
push: true
file: opendc-web/opendc-web-server/Dockerfile
tags: ${{ steps.prep.outputs.tags }}
push-ui:
name: Push UI to DockerHub
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/atlarge-research/opendc-web-ui
VERSION=3.0-SNAPSHOT
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v5
with:
push: true
context: opendc-web/opendc-web-ui
tags: ${{ steps.prep.outputs.tags }}
publish-maven-central:
name: Publish to Maven Central
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
- name: Prepare
id: prep
run: |
VERSION=3.0-SNAPSHOT
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Publish with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: publish -Pversion="${{ steps.prep.outputs.version }}"
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}