-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (83 loc) · 2.33 KB
/
release-common.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
name: Release common
on:
workflow_dispatch: # Allow manually triggered workflow run
push:
paths:
- common/**
- gradle/libs.versions.toml
jobs:
build:
name: Verification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
# Build
- name: Test and build
run: ./gradlew :common:build --configuration-cache
release-dev:
name: Create Release - Dev
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- name: Create Release
id: create_release
uses: elgohr/Github-Release-Action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: common.dev
prerelease: true
- name: Upload artifact
run: ./gradlew :common:publish -Pversion="dev.$(echo $GITHUB_SHA | cut -c 1-12).dev"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- name: Set release tag
run: |
export TAG_NAME="$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M).$(echo $GITHUB_SHA | cut -c 1-12)"
echo "RELEASE_TAG=$TAG_NAME" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: elgohr/Github-Release-Action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: common.${{ env.RELEASE_TAG }}
- name: Upload artifact
run: ./gradlew :common:publish -Pversion="${{ env.RELEASE_TAG }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}