Version 1.3.0 #74
Workflow file for this run
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
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | |
name: Maven Deploy | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
shell: bash | |
- name: Build project | |
run: | | |
mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }} | |
mvn versions:commit | |
mvn clean | |
mvn install -P prod | |
- name: Archive server | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Server | |
path: backend/target/server.jar | |
deploy-github: | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get release | |
id: get_release | |
uses: bruceadams/get-release@v1.2.3 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: Server | |
path: backend/target/ | |
- name: Archive application wait html | |
run: tar -C script/ -cf wait-for-app.tar wait-for-app-html | |
- name: Github release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
backend/target/server.jar | |
wait-for-app.tar | |
deploy-docker: | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: alex9849 | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
shell: bash | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: Server | |
path: backend/target/ | |
- name: Build images | |
run: | | |
docker build -t alex9849/cocktailpi:${{ steps.get_version.outputs.VERSION }} -f script/docker/Dockerfile . | |
docker tag alex9849/cocktailpi:${{ steps.get_version.outputs.VERSION }} alex9849/cocktailpi:latest | |
- name: Push images | |
run: docker push alex9849/cocktailpi --all-tags | |