-
-
Notifications
You must be signed in to change notification settings - Fork 201
143 lines (131 loc) · 4.51 KB
/
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
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
name: Create Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
# VALIDATE TAGS
- id: validate-semver
name: Validate tag against semantic versioning
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
SEMVER_PATTERN="^refs/tags/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
if [[ ! $GITHUB_REF =~ $SEMVER_PATTERN ]]
then
echo "Tag $GITHUB_REF does not follow semantic versioning"
exit 1
fi
# SETUP BUILD ENVIRONMENT
- id: prepare-maven-build
name: Prepare Maven build
uses: sualeh/[email protected]
with:
java-version: 8
- id: install-graphviz
name: Install Graphviz
uses: sualeh/[email protected]
# BUILD FOR DISTRIBUTION
- id: build
name: Build and test for distribution
shell: bash
run: |
# Build
mvn \
--no-transfer-progress \
--batch-mode \
-Ddistrib \
clean install
# BUILD AND PUBLISH DOCKER IMAGE
- id: setup-qemu
name: Setup QEMU
uses: docker/setup-qemu-action@v3
- id: setup-buildx
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
file: ./schemacrawler-docker/Dockerfile
context: ./schemacrawler-distrib/target/_expanded-distribution
platforms: |-
linux/amd64
linux/arm64
tags: |-
schemacrawler/schemacrawler:v16.25.2
schemacrawler/schemacrawler:latest
sbom: true
provenance: true
push: true
# CREATE GITHUB RELEASE AND ADD ASSETS
- id: upload-artifacts
name: Upload installers
uses: actions/upload-artifact@v4
with:
name: release-artifacts-v16.25.2
path: |
./schemacrawler-distrib/target/schemacrawler-16.25.2-distribution.zip
./schemacrawler-distrib/target/schemacrawler-16.25.2-distribution.zip.SHA-512
./schemacrawler-distrib/target/schemacrawler-16.25.2-bin.zip
./schemacrawler-distrib/target/schemacrawler-16.25.2-bin.zip.SHA-512
retention-days: 1
- id: create-release
name: Create GitHub release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
body: |
SchemaCrawler ${{ github.event.release.tag_name }} release at last commit ${{ github.sha }}
See the change history at https://www.schemacrawler.com/changes-report.html
generate_release_notes: true
files: |
./schemacrawler-distrib/target/schemacrawler-16.25.2-distribution.zip
./schemacrawler-distrib/target/schemacrawler-16.25.2-distribution.zip.SHA-512
./schemacrawler-distrib/target/schemacrawler-16.25.2-bin.zip
./schemacrawler-distrib/target/schemacrawler-16.25.2-bin.zip.SHA-512
# PUBLISH TO CENTRAL REPOSITORY
- id: install-secret-key
name: Install secret key
if: startsWith(github.ref, 'refs/tags/')
# Note: OSSRH_GPG_SECRET_KEY is exported using gpg --export-secret-keys -a <keyid>
# and has newlines substituted with a literal \n
shell: bash
run: |
# Install secret key
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: publish-to-central
name: Publish to Central Repository
if: startsWith(github.ref, 'refs/tags/')
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
shell: bash
run: |
# Publish to Central Repository
export GPG_TTY=$(tty)
mvn \
--no-transfer-progress \
--batch-mode \
-Ddistrib \
-Dmaven.javadoc.skip=false \
-Dskip.signing.artifacts=false \
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
clean deploy