check version

This commit is contained in:
anhefti 2021-04-22 13:56:06 +02:00
parent 1b2be41e1e
commit bf92e51734

View file

@ -14,120 +14,103 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
name: Branch name name: Set env
id: branch_name run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Test
run: | run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} echo $TAG_NAME
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} echo ${{ env.TAG_NAME }}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} # -
- # name: Get short SHA
name: Put names to env # uses: benjlevesque/short-sha@v1.2
run: | # id: short-sha
echo $SOURCE_NAME # -
echo $SOURCE_BRANCH # name: Store short SHA as environment variable
echo $SOURCE_TAG # run: echo $SHA
env: # env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }} # SHA: ${{ steps.short-sha.outputs.sha }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }} # -
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} # name: Checkout repository
- # uses: actions/checkout@v2
name: Get short SHA # -
uses: benjlevesque/short-sha@v1.2 # name: Set up JDK 8
id: short-sha # uses: actions/setup-java@v2
- # with:
name: Store short SHA as environment variable # java-version: '8'
run: echo $SHA # distribution: 'adopt'
env: # -
SHA: ${{ steps.short-sha.outputs.sha }} # name: Cache Maven packages
- # uses: actions/cache@v2
name: Checkout repository # with:
uses: actions/checkout@v2 # path: ~/.m2
- # key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
name: Set up JDK 8 # restore-keys: ${{ runner.os }}-m2
uses: actions/setup-java@v2 # -
with: # name: Build with Maven
java-version: '8' # run: mvn clean install -e -P let_reporting -Dsebserver-version="${{ env.SHA }}"
distribution: 'adopt' # env:
- # sebserver-version: ${{ env.SHA }}
name: Cache Maven packages # -
uses: actions/cache@v2 # name: Reporting
with: # uses: codecov/codecov-action@v1
path: ~/.m2 # with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} # flags: unittests
restore-keys: ${{ runner.os }}-m2 # name: SEB Server Build
- # fail_ci_if_error: false
name: Build with Maven # verbose: false
run: mvn clean install -e -P let_reporting -Dsebserver-version="${{ env.SHA }}" # -
env: # name: Simplify package name
sebserver-version: ${{ env.SHA }} # run: mv target/seb-server-${{ env.SHA }}.jar target/seb-server.jar
- # -
name: Reporting # uses: actions/upload-artifact@v2
uses: codecov/codecov-action@v1 # with:
with: # name: Package
flags: unittests # path: target/seb-server.jar
name: SEB Server Build #
fail_ci_if_error: false # docker-build:
verbose: false # needs: maven-build
- #
name: Simplify package name # runs-on: ubuntu-latest
run: mv target/seb-server-${{ env.SHA }}.jar target/seb-server.jar # steps:
- # -
uses: actions/upload-artifact@v2 # name: Set up QEMU
with: # uses: docker/setup-qemu-action@v1
name: Package # -
path: target/seb-server.jar # name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
docker-build: # -
needs: maven-build # name: Login to DockerHub
# Run only on tagging # uses: docker/login-action@v1
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') # with:
runs-on: ubuntu-latest # username: ${{ secrets.DOCKERHUB_USERNAME }}
steps: # password: ${{ secrets.DOCKERHUB_TOKEN }}
- # -
name: Set up QEMU # name: Checkout repository
uses: docker/setup-qemu-action@v1 # uses: actions/checkout@v2
- # -
name: Set up Docker Buildx # name: Download a single artifact
uses: docker/setup-buildx-action@v1 # uses: actions/download-artifact@v2
- # with:
name: Login to DockerHub # name: Package
uses: docker/login-action@v1 # -
with: # name: Get short SHA
username: ${{ secrets.DOCKERHUB_USERNAME }} # uses: benjlevesque/short-sha@v1.2
password: ${{ secrets.DOCKERHUB_TOKEN }} # id: short-sha
- # -
name: Checkout repository # name: Store short SHA as environment variable
uses: actions/checkout@v2 # run: echo $SHA
- # env:
name: Download a single artifact # SHA: ${{ steps.short-sha.outputs.sha }}
uses: actions/download-artifact@v2 # -
with: # name: Build and push
name: Package # id: docker_build
# - # uses: docker/build-push-action@v2
# name: Generate tags # with:
# id: docker_tags # context: .
# uses: dnaka91/action-docker-tags@v0.1 # file: ./docker/Dockerfile
# - # push: true
# name: Show generated tags # tags: |
# run: echo "${{ steps.docker_tags.outputs.tags }}" # anhefti/seb-server:latest
- # anhefti/seb-server:${{ env.SHA }}
name: Get short SHA #
uses: benjlevesque/short-sha@v1.2
id: short-sha
-
name: Store short SHA as environment variable
run: echo $SHA
env:
SHA: ${{ steps.short-sha.outputs.sha }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
anhefti/seb-server:latest
anhefti/seb-server:${{ env.SHA }}