From 9bf75d6387ddb58a184ca1ccc64645d3ad0ef174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez=20Gonzales?= Date: Thu, 24 Aug 2023 14:47:48 -0600 Subject: [PATCH] Add release workflow (#70) --- .github/actions/setup-build/action.yml | 18 +++++++++++++++++ .github/workflows/clojure.yml | 17 +++++++++------- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++ project.clj | 12 +++++++---- 4 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 .github/actions/setup-build/action.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml new file mode 100644 index 0000000..26858fb --- /dev/null +++ b/.github/actions/setup-build/action.yml @@ -0,0 +1,18 @@ +name: Set up Build +description: Sets up Build +runs: + using: "composite" + steps: + - uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: temurin + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} + restore-keys: ${{ runner.os }}-lein- + - name: Clear existing docker image cache + shell: bash + run: docker image prune -af diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index 22bfe20..cc8c47d 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -6,14 +6,17 @@ on: pull_request: branches: [ master ] +permissions: + contents: read + jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: lein deps - - name: Run tests - run: lein test + - uses: actions/checkout@v3 + - name: Setup Build + uses: ./.github/actions/setup-build + - name: Install dependencies + run: lein deps + - name: Run tests + run: lein test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7b94bf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Build + uses: ./.github/actions/setup-build + - name: Set version + run: | + lein change version set '"${{github.event.release.tag_name}}"' + - name: Release ${{github.event.release.tag_name}} + run: lein with-profile release deploy maven + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/project.clj b/project.clj index 6159c99..45e8793 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,7 @@ -(defproject clj-test-containers "0.7.4" - :description "A lightweight, unofficial wrapper around the Testcontainers Java library" +(defproject clj-test-containers "unspecified" + :description "A lightweight, official wrapper around the Testcontainers Java library" - :url "https://github.com/javahippie/clj-test-containers" + :url "https://github.com/testcontainers/testcontainers-clj" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} @@ -25,6 +25,10 @@ [org.testcontainers/postgresql "1.19.0"] [com.fzakaria/slf4j-timbre "0.3.21"] [nrepl "1.0.0"]] - :source-paths ["dev-src"]}} + :source-paths ["dev-src"]} + :release {:deploy-repositories [["maven" {:url "https://oss.sonatype.org/service/local/staging/deploy/maven2" + :username :env/ossrh_username + :password :env/ossrh_password + :sign-releases false}]]}} :target-path "target/%s")