forked from liquibase/liquibase
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.27 KB
/
build-main.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
name: Build Main/Master SNAPSHOT
on:
workflow_dispatch:
schedule:
- cron: "5 6 * * *"
push:
branches:
- 'main'
- 'master'
env:
MAVEN_VERSION: '3.9.2'
jobs:
build-master:
name: Build & Package Master
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Java for publishing to GitHub Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: liquibase
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: ${{ env.MAVEN_VERSION }}
# Version artifact based off of branch and commit SHA.
- name: Version Artifact
run: mvn versions:set -DnewVersion="master-SNAPSHOT"
# Publish to GitHub Packages
- name: Publish package
run: mvn -B clean deploy -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-sha:
name: Build & Package SHA
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Java for publishing to GitHub Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: liquibase
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: ${{ env.MAVEN_VERSION }}
# Version artifact based off of branch and commit SHA.
- name: Version Artifact
run: mvn versions:set -DnewVersion="$(git rev-parse --short HEAD)-SNAPSHOT"
# This would still deploy a package if there are test failures. Might help to have build.yml complete and then run this workflow
# Publish to GitHub Packages
- name: Publish package
run: mvn -B clean deploy -DskipTests=true "-Dbuild.branch=${{ github.ref_name }}" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ github.sha }}" "-Dbuild.repository.owner=${{ github.repository_owner }}" "-Dbuild.repository.name=${{ github.repository }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}