Adjusting tagging of images #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: T2P Pipeline | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
settings-path: ${{ github.workspace }} | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=woped_T2P | |
- name: Build | |
run: mvn clean install -Dmaven.test.skip=true --no-transfer-progress | |
- name: Set Release version env variable | |
run: | | |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Add SHORT_SHA env property with commit short sha | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
- uses: rishabhgupta/split-by@v1 | |
id: split | |
with: | |
string: '${{ env.RELEASE_VERSION }}' | |
split-by: '.' | |
- name: | |
run: | | |
echo "major_version=${{ steps.split.outputs._0}}" | |
echo "major_version=${{ steps.split.outputs._0}}" >> $GITHUB_ENV | |
echo "minor_version=${{ steps.split.outputs._1}}" | |
echo "minor_version=${{ steps.split.outputs._1}}" >> $GITHUB_ENV | |
echo "patch_version=${{ steps.split.outputs._2}}" | |
echo "patch_version=${{ steps.split.outputs._2}}" >> $GITHUB_ENV | |
- uses: rishabhgupta/split-by@v1 | |
id: split2 | |
with: | |
string: '${{ env.patch_version }}' | |
split-by: '-' | |
- name: | |
run: | | |
echo "patch_version=${{ steps.split2.outputs._0}}" | |
echo "patch_version=${{ steps.split2.outputs._0}}" >> $GITHUB_ENV | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ${{ github.workspace }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit: master | |
allowUpdates: 'true' | |
tag: "${{ env.major_version }}.${{ env.minor_version }}.${{ env.patch_version }}-${{ env.SHORT_SHA }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
version: v0.6.3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
woped/text2process:latest | |
woped/text2process:${{ env.RELEASE_NAME }} | |
woped/text2process:${{ env.major_version }} | |
woped/text2process:${{ env.major_version }}.${{ env.minor_version }} | |
woped/text2process:${{ env.major_version }}.${{ env.minor_version }}.${{ env.patch_version }} | |
woped/text2process:${{ env.major_version }}.${{ env.minor_version }}.${{ env.patch_version }}-${{ env.SHORT_SHA }} | |