-
Notifications
You must be signed in to change notification settings - Fork 5
135 lines (120 loc) · 4.5 KB
/
publish-ter.yml
File metadata and controls
135 lines (120 loc) · 4.5 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
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
name: Publish to TER
on:
push:
tags:
- "*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release tag in x.y.z format"
required: true
type: string
dry_run:
description: "Create the TER artefact without publishing it"
required: false
default: false
type: boolean
concurrency:
group: ter-publish-${{ github.repository }}-${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}
cancel-in-progress: false
jobs:
publish:
name: Publish new version to TER
runs-on: ubuntu-latest
permissions:
contents: read
env:
COMPOSER_HOME: ${{ github.workspace }}/.composer
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'true' || 'false' }}
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}
TYPO3_EXTENSION_KEY: feed_display
TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
TYPO3_EXCLUDE_FROM_PACKAGING: ${{ github.workspace }}/support/Build/Tailor/ExcludeFromPackaging.php
TAILOR_VERSION: 1.7.0
steps:
- name: Validate release tag format
run: |
set -euo pipefail
if ! [[ "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Release version '${RELEASE_VERSION}' must match x.y.z."
exit 1
fi
- name: Checkout workflow support files
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
path: support
- name: Checkout tagged release
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.version) || github.ref }}
path: release
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: curl, json, zip
tools: composer:v2
- name: Install Tailor
run: |
set -euo pipefail
composer global require --no-interaction --no-progress --prefer-dist "typo3/tailor:${TAILOR_VERSION}"
- name: Prepare release metadata
run: |
set -euo pipefail
bash support/Build/Scripts/prepareTerPublish.sh "${RELEASE_VERSION}" "${GITHUB_ENV}" release
- name: Verify TYPO3 API token
if: env.DRY_RUN != 'true'
run: |
set -euo pipefail
if [[ -z "${TYPO3_API_TOKEN:-}" ]]; then
echo "::error::Repository secret TYPO3_API_TOKEN is missing."
exit 1
fi
- name: Verify TER access
if: env.DRY_RUN != 'true'
working-directory: release
run: |
set -euo pipefail
output="$(
php "${COMPOSER_HOME}/vendor/bin/tailor" -n ter:details "${TYPO3_EXTENSION_KEY}" 2>&1
)" || {
printf '%s\n' "${output}"
exit 1
}
- name: Abort if version already exists in TER
if: env.DRY_RUN != 'true'
working-directory: release
run: |
set -euo pipefail
if php "${COMPOSER_HOME}/vendor/bin/tailor" -n ter:version "${RELEASE_VERSION}" "${TYPO3_EXTENSION_KEY}" > /dev/null 2>&1; then
echo "::error::Version ${RELEASE_VERSION} is already published on TER."
exit 1
fi
- name: Create TER artefact
working-directory: release
run: |
set -euo pipefail
php "${COMPOSER_HOME}/vendor/bin/tailor" -n create-artefact "${RELEASE_VERSION}" "${TYPO3_EXTENSION_KEY}" --path=.
- name: Verify TER artefact contents
working-directory: release
run: |
set -euo pipefail
artefact="$(echo tailor-version-artefact/*.zip)"
bash ../support/Build/Scripts/verifyTerArtefact.sh "${artefact}"
- name: Upload TER artefact
if: env.DRY_RUN == 'true'
uses: actions/upload-artifact@v4
with:
name: ter-artefact-${{ env.RELEASE_VERSION }}
path: release/tailor-version-artefact/*.zip
if-no-files-found: error
- name: Publish to TER
if: env.DRY_RUN != 'true'
working-directory: release
run: |
set -euo pipefail
artefact="$(echo tailor-version-artefact/*.zip)"
php "${COMPOSER_HOME}/vendor/bin/tailor" -n ter:publish "${RELEASE_VERSION}" "${TYPO3_EXTENSION_KEY}" --artefact="${artefact}" --comment "${comment}"