forked from TYPO3-Console/TYPO3-Console
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (80 loc) · 3.67 KB
/
Update.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
name: Update
on: [ push ]
defaults:
run:
shell: bash
jobs:
Extension-Repo:
name: 'Extension Repo'
if: github.repository == 'TYPO3-Console/TYPO3-Console'
runs-on: ubuntu-latest
steps:
- name: Checkout main repo
uses: actions/checkout@v4
with:
path: ./typo3-console
- name: Checkout extension repo
uses: actions/checkout@v4
with:
repository: TYPO3-Console/Extension
token: ${{ secrets.EXTENSION_UPDATE_TOKEN }}
path: ./extension
- name: Composer Cache Vars
id: composer-cache-vars
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "timestamp=$(date +"%s")" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-^11.5.26-stable-8.1-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-^11.5.26-stable-8.1-
${{ runner.os }}-composer-^11.5.26-stable-
${{ runner.os }}-composer-^11.5.26-
${{ runner.os }}-composer-
- name: Set up PHP Version 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: none
- name: "Extract tag, branch, version from GITHUB_REF"
id: "github-ref"
run: |
echo "tag=$(echo $GITHUB_REF | sed -E -n 's#^refs/tags/(.*)$#\1#p')" >> $GITHUB_OUTPUT
echo "branch=$(echo $GITHUB_REF | sed -E -n 's#^refs/heads/(.*)$#\1#p')" >> $GITHUB_OUTPUT
echo "version=$(echo $GITHUB_REF | sed -E -n 's#^refs/tags/v?([0-9]+\.)([0-9]+\.)([0-9]+)#\1\2\3#p')" >> $GITHUB_OUTPUT
- name: Checkout extension branch
if: steps.github-ref.outputs.branch != ''
run: |
cd ./extension
git fetch origin && git checkout origin/${{ steps.github-ref.outputs.branch }} -b ${{ steps.github-ref.outputs.branch }} || true
cd -
- name: Package extension
run: |
cd ./typo3-console
composer extension-release
cd -
- name: Add extension changes
run: |
cd ./extension
git config user.email "[email protected]"
git config user.name "Helmut Hummel"
git checkout README.md
git add .
cd -
- name: Commit and push extension version
if: steps.github-ref.outputs.version != ''
run: |
cd ./extension
git commit -m "Release extension version ${{ steps.github-ref.outputs.version }}"
git tag ${{ steps.github-ref.outputs.tag }}
git push --tags
- name: Commit and push extension branch
if: steps.github-ref.outputs.branch != ''
run: |
cd ./extension
git commit -m "Update extension based on commit $GITHUB_SHA"
git push origin HEAD:${{ steps.github-ref.outputs.branch }}