-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (81 loc) · 2.79 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (81 loc) · 2.79 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
84
85
86
87
88
89
90
91
92
93
94
name: Release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish (for example: 0.1.5)"
required: true
type: string
permissions:
contents: write
packages: write
actions: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
DOCKER_HOST: unix:///var/run/docker.sock
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
TESTCONTAINERS_RYUK_DISABLED: false
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
fetch-depth: 0
- name: Resolve release context
id: context
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
if ! git rev-parse "refs/tags/${{ inputs.tag }}" >/dev/null 2>&1; then
echo "::error::GATE_TAG_NOT_FOUND: tag '${{ inputs.tag }}' not found."
exit 17
fi
echo "tag_name=${{ inputs.tag }}" >> "${GITHUB_OUTPUT}"
echo "target_sha=$(git rev-list -n 1 "refs/tags/${{ inputs.tag }}")" >> "${GITHUB_OUTPUT}"
else
echo "tag_name=${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
echo "target_sha=$(git rev-list -n 1 "${GITHUB_REF}")" >> "${GITHUB_OUTPUT}"
fi
- name: Set up JDK 11
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "11"
cache: maven
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Build and deploy Maven packages
run: mvn -B clean deploy -Dmaven.test.skip=true -pl flexdblink,flexdblink-maven-plugin
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create or update GitHub Release and upload assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ steps.context.outputs.tag_name }}
run: |
set -euo pipefail
shopt -s nullglob
assets=(
flexdblink/target/FlexDBLink*.jar
flexdblink/target/FlexDBLink*.zip
flexdblink/target/flexdblink-*.jar
flexdblink/target/flexdblink-*.zip
)
if [ "${#assets[@]}" -eq 0 ]; then
echo "::error::No release assets found."
exit 18
fi
if gh release view "${TAG_NAME}" >/dev/null 2>&1; then
gh release upload "${TAG_NAME}" "${assets[@]}" --clobber
else
gh release create "${TAG_NAME}" "${assets[@]}" --title "${TAG_NAME}" --generate-notes
fi