-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (134 loc) · 5.12 KB
/
build_phonemadness.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: 'build: PhoneMadness'
on:
#push:
# #branches:
# # - 'main'
# # - 'master'
# paths:
# - '.github/workflows/build_phonemadness.yaml'
# - 'alpine.Dockerfile'
# - 'src/*'
# - 'pom.xml'
# tags:
# - "v*.*.*"
workflow_dispatch:
#schedule:
# - cron: '30 5 26 * *' # At 05:30 on day-of-month 26.
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Shell-Script
id: script
run: |
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
COMMIT_HASH=${GITHUB_SHA::8}
GITHUB_REPO=${GITHUB_REPOSITORY,,}
GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
#DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/rpi-phonemadness
#REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
GITHUB_TAG=${GITHUB_REF_NAME}
# Set output parameters to GitHub action.
echo ::set-output name=build_date::${BUILD_DATE}
echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
echo ::set-output name=commit_hash::${COMMIT_HASH}
echo ::set-output name=github_repo::${GITHUB_REPO}
echo ::set-output name=docker_repo::${DOCKER_REPO}
#echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
echo ::set-output name=github_tag::${GITHUB_TAG}
- name: Java-Setup
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
architecture: x64
cache: maven
- name: Java-build
run: mvn --batch-mode package --file pom.xml -DskipTests
- name: Package-prepare
run: |
#ls -la target/
mkdir -p phonemadness/config
cp target/*-jar-with-dependencies.jar phonemadness/TelefonWahnsinn.jar
cp config/config.xml.example phonemadness/config/config.xml
ls -la phonemadness/
tar cvpzf TelefonWahnsinn.tar.gz phonemadness/
- name: Package-Artifact-Upload
uses: actions/upload-artifact@v3
with:
name: TelefonWahnsinn
path: phonemadness
- name: Package-Release-Upload
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
#body_path: RELEASE_INFO.md
body: "For more information read README."
draft: false
prerelease: false
files: |
TelefonWahnsinn.tar.gz
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
#- name: Login to RED HAT Quay.io Container Registry
# uses: docker/login-action@v2
# with:
# registry: quay.io
# username: ${{ secrets.REDHAT_QUAY_USERNAME }}
# password: ${{ secrets.REDHAT_QUAY_PASSWORD }}
- name: Build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./alpine.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6
pull: true
push: true
build-args: |
BUILD_DATE=${{steps.script.outputs.build_date}}
VCS_REF=${{steps.script.outputs.commit_hash}}
PHONEMADNESS_VERSION="1.0.0"
# PHONEMADNESS_VERSION=${{steps.script.outputs.github_tag}}
tags: |
docker.io/${{steps.script.outputs.docker_repo}}:latest
ghcr.io/${{steps.script.outputs.github_repo}}:latest
# ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.github_tag}}
# ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
# quay.io/${{steps.script.outputs.redhat_quay_repo}}:latest
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{steps.script.outputs.docker_repo}}
#short-description: ${{ github.event.repository.description }}
short-description: "PhoneMadness: Java-App monitors various sensors and switched accordingly the music to pause or play."
readme-filepath: README.md