-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.98 KB
/
Copy pathmain.yml
File metadata and controls
63 lines (53 loc) · 1.98 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
name: CI build
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * *"
timezone: "Australia/Brisbane"
workflow_dispatch:
env:
OCTOPUS_SPACE: "Developer Experience"
jobs:
test-build-and-publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required to obtain the ID token from GitHub Actions
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
submodules: 'true'
- name: Build, Test, Pack, and Deploy (CI)
uses: ./.github/actions/build-test-pack-deploy
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
prerelease-tag: "ci"
octopus-url: ${{ secrets.OCTOPUS_URL }}
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Prepare PR version suffix
if: github.event_name == 'pull_request'
id: pr-version
run: |
BRANCH_NAME="${{ github.head_ref }}"
# Sanitize: replace special chars with hyphens, convert to lowercase
SANITIZED=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g' | sed 's/^-*//' | sed 's/-*$//')
# Truncate to 20 characters
TRUNCATED=${SANITIZED:0:20}
# Remove trailing hyphens after truncation
TRUNCATED=$(echo "$TRUNCATED" | sed 's/-*$//')
echo "branch-name=$TRUNCATED" >> $GITHUB_OUTPUT
- name: Build, Test, Pack, and Deploy (PR)
uses: ./.github/actions/build-test-pack-deploy
if: github.event_name == 'pull_request'
with:
prerelease-tag: pr.${{ github.event.pull_request.number }}.${{ steps.pr-version.outputs.branch-name }}
octopus-url: ${{ secrets.OCTOPUS_URL }}
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}