From a0d46acf850b7b7c899f9fcd5a300b0b01db274f Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 6 Jan 2023 14:20:59 +0100 Subject: ci: Fix GH Actions workflow for publishing Docker images This change updates the GitHub Actions pipeline that is used to publish the Docker images when a new release is published. Since the web API implementation was moved to `opendc-web/opendc-web-server`, this workflow started failing. Furthermore, we remove the use of the deprecated `::set-output` syntax. --- .github/workflows/publish.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to '.github/workflows/publish.yml') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4f4357d0..6bc5e2bc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,8 +17,7 @@ jobs: if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} fi - TAGS="${DOCKER_IMAGE}:${VERSION}" - echo ::set-output name=tags::${TAGS} + echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT - name: Login to DockerHub uses: docker/login-action@v2 with: @@ -43,8 +42,7 @@ jobs: if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} fi - TAGS="${DOCKER_IMAGE}:${VERSION}" - echo ::set-output name=tags::${TAGS} + echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT - name: Login to DockerHub uses: docker/login-action@v2 with: @@ -54,8 +52,7 @@ jobs: uses: docker/build-push-action@v3 with: push: true - file: opendc-web/opendc-web-api/Dockerfile - repository: atlargeresearch/opendc-web-api + file: opendc-web/opendc-web-server/Dockerfile tags: ${{ steps.prep.outputs.tags }} push-ui: name: Push UI @@ -69,8 +66,7 @@ jobs: if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} fi - TAGS="${DOCKER_IMAGE}:${VERSION}" - echo ::set-output name=tags::${TAGS} + echo "tags=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_OUTPUT - name: Login to DockerHub uses: docker/login-action@v2 with: @@ -81,5 +77,4 @@ jobs: with: push: true context: opendc-web/opendc-web-ui - repository: atlargeresearch/opendc-web-ui tags: ${{ steps.prep.outputs.tags }} -- cgit v1.2.3 From 0c0a823fec1e67be6f9e72c0c790636f364f8b23 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 6 Jan 2023 14:41:33 +0100 Subject: ci: Pin version of GitHub Actions runner images This change pins the versions of the GitHub Actions runner images used by our workflows to prevent regressions when the latest Ubuntu/Windows image is updated. --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github/workflows/publish.yml') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6bc5e2bc..4a0f6cde 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: jobs: push-simulator: name: Push Simulator - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Prepare id: prep @@ -32,7 +32,7 @@ jobs: tags: ${{ steps.prep.outputs.tags }} push-api: name: Push API - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Prepare id: prep @@ -56,7 +56,7 @@ jobs: tags: ${{ steps.prep.outputs.tags }} push-ui: name: Push UI - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Prepare id: prep -- cgit v1.2.3 From 7e97b34f96cbaab14466d73a8179a5e6d98449d5 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 6 Jan 2023 15:05:06 +0100 Subject: ci: Publish to Maven Central in publish workflow This change updates the release and publish workflows in GitHub Actions to ensure that we only publish the artifacts to Maven Central once the release on GitHub is published. When a version tag is pushed to GitHub, only a draft release will be created containing the right artifacts. --- .github/workflows/publish.yml | 57 +++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to '.github/workflows/publish.yml') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4a0f6cde..ce25802f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,5 @@ -name: Publish Docker image +# Workflow for publishing the artifacts once a GitHub release is published +name: Publish on: release: @@ -6,16 +7,16 @@ on: jobs: push-simulator: - name: Push Simulator + name: Push Simulator to DockerHub runs-on: ubuntu-22.04 steps: - name: Prepare id: prep run: | DOCKER_IMAGE=atlargeresearch/opendc - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} + 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 @@ -31,16 +32,16 @@ jobs: repository: atlargeresearch/opendc tags: ${{ steps.prep.outputs.tags }} push-api: - name: Push API + name: Push API to DockerHub runs-on: ubuntu-22.04 steps: - name: Prepare id: prep run: | DOCKER_IMAGE=atlargeresearch/opendc-web-api - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} + 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 @@ -55,16 +56,16 @@ jobs: file: opendc-web/opendc-web-server/Dockerfile tags: ${{ steps.prep.outputs.tags }} push-ui: - name: Push UI + name: Push UI to DockerHub runs-on: ubuntu-22.04 steps: - name: Prepare id: prep run: | DOCKER_IMAGE=atlargeresearch/opendc-web-ui - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} + 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 @@ -78,3 +79,33 @@ jobs: 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@v3 + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 17 + - 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 }} -- cgit v1.2.3