Skip to content

Commit

Permalink
CI pipeline with build test and publish jobs (#1762)
Browse files Browse the repository at this point in the history
* use ci-release plugin for automated publish and release

* Fix conditional statement in ci.yml for publishing releases

* temporarily run CI publish also for PRs

* disable automated release note publishing

* remove sonatype release command override

* publish to sonatype central using temporary account

* Update Publish.scala to use sonatypePublishToBundle for publishing

* add sonatypeRepository

* add sonatype s01 host config

* publish using ci-release plugin

* trigger pipeline on test branch

* Update organization in Publish.scala

* override default sonatype central deployment name

* Refactor Publish.scala to update sonatypeCentralDeploymentName

* update publish settings to fix publish path and sonatype profile name

* update sonatypeProfileName to match sonatype account settings

* adds pomExtra config

* support publish to Azure

* reorganize ci pipeline and add write permissions to ci job

* upgrade release-drafter version

* fix azure credentials script

* add some debugging

* fix multi-line credentials file

* temporarily remove ci dependency in the pipeline

* test azure credentials

* remove cat line

* enable all steps in ci pipeline

* publish to sonatype only when manually triggered and for new tags

* publish all modules of baker
  • Loading branch information
bekiroguz authored Sep 26, 2024
1 parent cbcfc88 commit 1423620
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 188 deletions.
33 changes: 33 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependency'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
129 changes: 129 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: CI
on:
workflow_dispatch:
pull_request:
branches: ["master"]
push:
branches: ["master"]
tags: ["v*"]

permissions:
contents: read

jobs:
ci:
name: Build and test
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Run tests and coverage
run: |-
cp .jvmopts-ci .jvmopts
sbt coverage test coverageReport && bash <(curl -s https://codecov.io/bash)
- name: Prepare draft release notes
continue-on-error: true
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-sonatype:
permissions:
contents: write
pull-requests: write
name: Publish to Sonatype
# Publish to Sonatype only on tags starting with 'v' and on workflow_dispatch
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Publish to Sonatype
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
publish-azure:
permissions:
contents: write
pull-requests: write
name: Publish to Azure
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Publish to Azure
run: |-
echo "Prepare credentials"
CONTENTS=$(cat << EOF
realm=pkgs.dev.azure.com
host=pkgs.dev.azure.com
user=$AZURE_FEEDUSER
password=$AZURE_FEEDPASSWORD
EOF
)
echo "$CONTENTS" > ~/.credentials
sbt "clean; +aetherDeploy; project interaction-example-make-payment-and-ship-items; +aetherDeploy; project interaction-example-reserve-items; +aetherDeploy; project bakery-client-example; +aetherDeploy; project bakery-kafka-listener-example; +aetherDeploy"
rm ~/.credentials
env:
AZURE_FEEDUSER: ${{ secrets.AZURE_FEEDUSER }}
AZURE_FEEDPASSWORD: ${{ secrets.AZURE_FEEDPASSWORD }}
AZURE_FEEDURL: ${{ secrets.AZURE_FEEDURL }}
dependency-submission:
name: Submit dependency graph
continue-on-error: true
needs: [ci]
# run on 1) master branch
# do not run on pull requests
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Submit dependency graph
uses: scalacenter/sbt-dependency-submission@v2

31 changes: 0 additions & 31 deletions .github/workflows/dependency-graph.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/publish.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/tests-and-coverage.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# PRs are created only again after 7 days since the last PR has passed
pullRequests.frequency = "7 days"
# Add custom labels to PRs to be used by the automated release process
pullRequests.customLabels = [ "dependency" ]
# group all patches, and typelevel updates
pullRequests.grouping = [
{ name = "patches", "title" = "Patch updates", "filter" = [{"version" = "patch"}] },
Expand Down
6 changes: 2 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ lazy val crossBuildSettings: Seq[Setting[_]] = Seq(
crossScalaVersions := supportedScalaVersions
)

lazy val defaultModuleSettings212: Seq[Setting[_]] = commonSettings ++ dependencyOverrideSettings

lazy val defaultModuleSettings: Seq[Setting[_]] = crossBuildSettings ++ defaultModuleSettings212
lazy val defaultModuleSettings: Seq[Setting[_]] = crossBuildSettings ++ commonSettings ++ dependencyOverrideSettings

lazy val yPartialUnificationSetting: Seq[Setting[_]] = Seq(
Compile / scalacOptions ++= {
Expand Down Expand Up @@ -650,7 +648,7 @@ lazy val `bakery-integration-tests`: Project = project.in(file("bakery/integrati
scalaCheck
)
)
.dependsOn(
.dependsOn(
`baker-http-client`,
`bakery-client-example`,
`interaction-example-make-payment-and-ship-items`,
Expand Down
3 changes: 0 additions & 3 deletions get-version.sh

This file was deleted.

Loading

0 comments on commit 1423620

Please sign in to comment.