-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (86 loc) · 2.93 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build release
on:
workflow_dispatch:
inputs:
releaseType:
description: Release type
required: true
type: choice
options:
- patch
- minor
- major
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: philipparndt/get-release-number@v1
id: next
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
releaseType: ${{ github.event.inputs.releaseType }}
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 8
- name: Update version to ${{ steps.next.outputs.version }}
env:
USENAME: ${{github.actor}}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ steps.next.outputs.version }}
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION --file src/pom.xml --settings .github/workflows/settings.xml
- name: Build with Maven
env:
USENAME: ${{github.actor}}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B package verify --file src/pom.xml --settings .github/workflows/settings.xml
- 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: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker container and push
id: docker_build
uses: docker/build-push-action@v2
env:
RELEASE_VERSION: ${{ steps.next.outputs.version }}
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
pharndt/cupsmqtt:latest
pharndt/cupsmqtt:${{env.RELEASE_VERSION}}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ steps.next.outputs.version }}
with:
tag_name: ${{env.RELEASE_VERSION}}
release_name: ${{env.RELEASE_VERSION}}
body: |
Docker tag: `pharndt/cupsmqtt:${{env.RELEASE_VERSION}}`
Changes in this Release
- ...
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./src/de.rnd7.cupsmqtt/target/cupsmqtt.jar
asset_name: cupsmqtt.jar
asset_content_type: application/jar