Skip to content

Merge pull request #167 from freenowtech/UP-3933-fix-python-poetry-bo… #47

Merge pull request #167 from freenowtech/UP-3933-fix-python-poetry-bo…

Merge pull request #167 from freenowtech/UP-3933-fix-python-poetry-bo… #47

name: Release Components
on:
push:
branches:
- main
paths:
- sauron-core/**
- sauron-plugin-archetype/**
- sauron-service/**
jobs:
package-and-publish:
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
strategy:
max-parallel: 1
matrix:
path: ["sauron-core/", "sauron-plugin-archetype/", "sauron-service/"]
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Check for changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
sauron-service:
- 'sauron-service/**'
src:
- '${{ matrix.path }}**'
- name: Update local git repository. It is needed because other jobs might have released a new version
run: git pull
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven release and publish
if: steps.changes.outputs.src == 'true'
uses: qcastel/github-actions-maven-release@v1.12.17
continue-on-error: true
with:
access-token: ${{ secrets.FREE_NOW_GITHUB_ACCESS_TOKEN }}
release-branch-name: "main"
maven-args: "-DskipTests -DskipITs"
git-release-bot-name: "free-now-github"
git-release-bot-email: "70742378+free-now-github@users.noreply.github.com"
git-skip-sanity-check: true
ssh-private-key: ${{ secrets.FREE_NOW_GITHUB_PRIVATE_KEY }}
maven-project-folder: ${{ matrix.path }}
maven-repo-server-id: ossrh
maven-repo-server-username: ${{ secrets.FREE_NOW_GITHUB_USER }}
maven-repo-server-password: ${{ secrets.FREE_NOW_MAVEN_ACCESS_TOKEN }}
gpg-enabled: true
gpg-key-id: ${{ secrets.FREE_NOW_GPG_KEY_ID }}
gpg-key: ${{ secrets.FREE_NOW_GPG_KEY }}
gpg-passphrase: ${{ secrets.FREE_NOW_GPG_PASSPHRASE }}
env:
JAVA_HOME: /usr/lib/jvm/java-11-openjdk/
- name: Get previous tag
if: steps.changes.outputs.src == 'true'
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1.0.1
- name: Github Release
if: steps.changes.outputs.src == 'true' && steps.changes.outputs.sauron-service == 'true'
uses: ncipollo/release-action@v1
with:
artifacts: "LICENSE, SECURITY.md, sauron-service/target/*.pom?(.)*, sauron-service/target/*.jar?(.)*, sauron-service/target/*-sources.jar?(.)*, sauron-service/target/*-javadoc.jar?(.)*release.tar.gz,foo/*.txt"
name: ${{ steps.previoustag.outputs.tag }}
tag: ${{ steps.previoustag.outputs.tag }}
- name: Extract version
if: steps.changes.outputs.src == 'true' && steps.changes.outputs.sauron-service == 'true'
id: extractversion
run: echo "::set-output name=version::$(cut -c16- <<< "${{ steps.previoustag.outputs.tag }}")"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
config: .github/buildkitd.toml
- name: Publish to Registry
if: steps.changes.outputs.src == 'true' && steps.changes.outputs.sauron-service == 'true'
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: freenowtech/sauron/sauron-service
username: ${{ secrets.FREE_NOW_GITHUB_USER }}
password: ${{ secrets.GITHUB_TOKEN }}
default_branch: main
workdir: sauron-service/
registry: ghcr.io
tags: "latest,${{ steps.extractversion.outputs.version }}"
platforms: linux/amd64,linux/arm64