This repository was archived by the owner on Nov 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
83 lines (79 loc) · 2.96 KB
/
buildAndRelease.yaml
File metadata and controls
83 lines (79 loc) · 2.96 KB
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
name: buildAndRelease
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
branch: 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Semantic Release Version
id: get-version
run: |
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
if [ "${branch}" == "main" ]; then
echo "::set-output name=version::$(grep -oP '\[\d+\.\d+\.\d+\]' CHANGELOG.md | tr -d '[]')"
else
echo "::set-output name=version::${branch}"
fi
- name: show version
run: |
echo "Semantic Release Version: ${{ steps.get-version.outputs.version }}"
- name: setup qemu for multi-arch build
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- name: setup buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
#registry: registry.hub.docker.com
username: wurstbrot
password: ${{ secrets.HUB_TOKEN }}
- name: Set up Java
uses: actions/setup-java@v5
with:
java-version: 17
distribution: temurin
- name: build
run: |
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
tag="${{ steps.get-version.outputs.version }}"
if [ "${branch}" == "main" ]; then
tag="${tag},latest"
fi
echo "tag: ${tag}, ${branch}"
./mvnw compile com.google.cloud.tools:jib-maven-plugin:3.2.0:build -Djib.from.image=eclipse-temurin:17-jre -Djib.container.environment=XDG_CONFIG_HOME=/tmp -Dimage=docker.io/wurstbrot/metric-analyzer -Djib.to.tags=${tag}
# Commit all changed files back to the repository
- uses: planetscale/ghcommit-action@v0.2.9
with:
commit_message: "🤖 BOT based relase commit"
repo: ${{ github.repository }}
branch: 'main'
env:
GITHUB_TOKEN: ${{secrets.ACCESS_TOKEN}}
heroku:
if: github.repository == 'devsecopsmaturitymodel/metricAnalyzer' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Set Heroku app & branch for ${{ github.ref }}"
run: |
echo "HEROKU_BRANCH=main" >> $GITHUB_ENV
- name: "Deploy ${{ github.ref }} to Heroku"
uses: akhileshns/heroku-deploy@e3eb99d45a8e2ec5dca08735e089607befa4bf28 # v3.14.15
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "metric-analyzer"
heroku_email: timo.pagel@owasp.org
branch: ${{ env.HEROKU_BRANCH }}