squash: Move docker setup after maven. #3
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: Build a docker image | |
on: | |
push: | |
branches: | |
- docker-test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: maven | |
- name: Build with Maven | |
run: mvn clean install | |
- name: Install xmllint | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install -y libxml2-utils | |
- name: Set tag Version | |
id: sets-tag-version | |
run: | | |
MVNVER=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" pom.xml) | |
TAG_NAME="v${MVNVER/-SNAPSHOT/}" | |
echo "Tag name: ${TAG_NAME}" | |
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_OUTPUT | |
- name: Create Tag | |
uses: rickstaa/[email protected] | |
with: | |
tag_exists_error: false | |
tag: ${{ steps.sets-tag-version.outputs.TAG_NAME }} | |
message: "Automated tag" | |
- name: Set version | |
run: | | |
VERSION=`git describe --match "v[0-9\.]*" --long --dirty --always` | |
echo "GITHUB_JMR_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver: docker | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: ./ | |
tags: | | |
jitsi/jitsi-multitrack-recorder:latest | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |