Skip to content

Commit 9c8cc0f

Browse files
Merge pull request #235 from moorl/Auto-Release
Auto release
2 parents c13e4d2 + 24b8140 commit 9c8cc0f

File tree

2 files changed

+153
-67
lines changed

2 files changed

+153
-67
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# .github/workflows/release.yml
2+
name: Tag from composer.json version
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ "3.x" ]
8+
paths:
9+
- composer.json
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
create-tag:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository (with history & tags)
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install jq
25+
run: sudo apt-get update && sudo apt-get install -y jq
26+
27+
- name: Get current and previous version
28+
id: versions
29+
shell: bash
30+
run: |
31+
# extract current version from composer.json
32+
CURR_VERSION=$(jq -r '.version // empty' composer.json)
33+
if [ -z "$CURR_VERSION" ] || [ "$CURR_VERSION" = "null" ]; then
34+
echo "composer.json has no .version field – aborting."
35+
exit 1
36+
fi
37+
38+
# get previous version from previous commit if composer.json existed there
39+
if git rev-parse HEAD~1 >/dev/null 2>&1; then
40+
if git show HEAD~1:composer.json >/dev/null 2>&1; then
41+
PREV_VERSION=$(git show HEAD~1:composer.json | jq -r '.version // empty')
42+
else
43+
PREV_VERSION=""
44+
fi
45+
else
46+
PREV_VERSION=""
47+
fi
48+
49+
echo "curr=$CURR_VERSION" >> "$GITHUB_OUTPUT"
50+
echo "prev=$PREV_VERSION" >> "$GITHUB_OUTPUT"
51+
52+
- name: Continue only if version changed
53+
if: steps.versions.outputs.curr != steps.versions.outputs.prev
54+
run: |
55+
echo "Version changed: ${{ steps.versions.outputs.prev }} -> ${{ steps.versions.outputs.curr }}"
56+
57+
- name: Stop if version is unchanged
58+
if: steps.versions.outputs.curr == steps.versions.outputs.prev
59+
run: |
60+
echo "Version unchanged (${{ steps.versions.outputs.curr }}) – no tag needed."
61+
exit 0
62+
63+
- name: Check if tag already exists
64+
id: check_tag
65+
run: |
66+
TAG="v${{ steps.versions.outputs.curr }}"
67+
if git rev-parse "refs/tags/$TAG" >/dev/null 2>&1 || \
68+
git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; then
69+
echo "exists=true" >> "$GITHUB_OUTPUT"
70+
else
71+
echo "exists=false" >> "$GITHUB_OUTPUT"
72+
fi
73+
74+
- name: Create and push tag (with v prefix)
75+
if: steps.check_tag.outputs.exists == 'false'
76+
run: |
77+
TAG="v${{ steps.versions.outputs.curr }}"
78+
git config user.name "github-actions[bot]"
79+
git config user.email "github-actions[bot]@users.noreply.github.com"
80+
git tag "$TAG"
81+
git push origin "$TAG"
82+
83+
- name: Info if tag already exists
84+
if: steps.check_tag.outputs.exists == 'true'
85+
run: echo "Tag v${{ steps.versions.outputs.curr }} already exists – nothing to do."

composer.json

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,71 @@
11
{
2-
"name": "ebics-api/ebics-client-php",
3-
"type": "library",
4-
"description": "PHP library to communicate with bank through EBICS protocol.",
5-
"keywords": [
6-
"ebics",
7-
"PHP",
8-
"client",
9-
"openssl",
10-
"rsa",
11-
"x509",
12-
"cfonb.120",
13-
"cfonb.240",
14-
"mt940",
15-
"mt942"
16-
],
17-
"authors": [
18-
{
19-
"name": "Andrew Svirin"
2+
"name": "ebics-api/ebics-client-php",
3+
"version": "3.0.1",
4+
"type": "library",
5+
"description": "PHP library to communicate with bank through EBICS protocol.",
6+
"keywords": [
7+
"ebics",
8+
"PHP",
9+
"client",
10+
"openssl",
11+
"rsa",
12+
"x509",
13+
"cfonb.120",
14+
"cfonb.240",
15+
"mt940",
16+
"mt942"
17+
],
18+
"authors": [
19+
{
20+
"name": "Andrew Svirin"
21+
}
22+
],
23+
"license": "MIT",
24+
"require": {
25+
"php": "^8.1",
26+
"ext-bcmath": "*",
27+
"ext-curl": "*",
28+
"ext-dom": "*",
29+
"ext-json": "*",
30+
"ext-openssl": "*",
31+
"ext-zip": "*",
32+
"ext-zlib": "*",
33+
"ext-libxml": "*"
34+
},
35+
"require-dev": {
36+
"ebics-api/cfonb-php": "^1.0",
37+
"ebics-api/mt942-php": "^1.0",
38+
"phpseclib/phpseclib": "~2.0.48",
39+
"phpstan/phpstan": "~1.9.18",
40+
"phpunit/phpunit": "~9.6.24",
41+
"psr/http-client": "^1.0",
42+
"psr/http-factory": "^1.0",
43+
"setasign/fpdf": "^1.8",
44+
"squizlabs/php_codesniffer": "~3.7.2"
45+
},
46+
"autoload": {
47+
"psr-4": {
48+
"EbicsApi\\Ebics\\": "src"
49+
}
50+
},
51+
"autoload-dev": {
52+
"psr-4": {
53+
"EbicsApi\\Ebics\\Tests\\": "tests"
54+
}
55+
},
56+
"suggest": {
57+
"ebics-api/cfonb-php": "If you need to parse format CFONB from FDL requests.",
58+
"ebics-api/mt942-php": "If you need to parse format MT942 from VMK, STA requests.",
59+
"setasign/fpdf": "If you need to generate PDF file letter for Bank."
60+
},
61+
"config": {
62+
"sort-packages": true
63+
},
64+
"minimum-stability": "dev",
65+
"prefer-stable": true,
66+
"scripts": {
67+
"code-test": "vendor/bin/phpunit",
68+
"code-style": "vendor/bin/phpcs",
69+
"code-analyse": "vendor/bin/phpstan"
2070
}
21-
],
22-
"license": "MIT",
23-
"require": {
24-
"php": "^8.1",
25-
"ext-bcmath": "*",
26-
"ext-curl": "*",
27-
"ext-dom": "*",
28-
"ext-json": "*",
29-
"ext-openssl": "*",
30-
"ext-zip": "*",
31-
"ext-zlib": "*",
32-
"ext-libxml": "*"
33-
},
34-
"require-dev": {
35-
"ebics-api/cfonb-php": "^1.0",
36-
"ebics-api/mt942-php": "^1.0",
37-
"phpseclib/phpseclib": "~2.0.48",
38-
"phpstan/phpstan": "~1.9.18",
39-
"phpunit/phpunit": "~9.6.24",
40-
"psr/http-client": "^1.0",
41-
"psr/http-factory": "^1.0",
42-
"setasign/fpdf": "^1.8",
43-
"squizlabs/php_codesniffer": "~3.7.2"
44-
},
45-
"autoload": {
46-
"psr-4": {
47-
"EbicsApi\\Ebics\\": "src"
48-
}
49-
},
50-
"autoload-dev": {
51-
"psr-4": {
52-
"EbicsApi\\Ebics\\Tests\\": "tests"
53-
}
54-
},
55-
"suggest": {
56-
"ebics-api/cfonb-php": "If you need to parse format CFONB from FDL requests.",
57-
"ebics-api/mt942-php": "If you need to parse format MT942 from VMK, STA requests.",
58-
"setasign/fpdf": "If you need to generate PDF file letter for Bank."
59-
},
60-
"config": {
61-
"sort-packages": true
62-
},
63-
"minimum-stability": "dev",
64-
"prefer-stable": true,
65-
"scripts": {
66-
"code-test": "vendor/bin/phpunit",
67-
"code-style": "vendor/bin/phpcs",
68-
"code-analyse": "vendor/bin/phpstan"
69-
}
7071
}

0 commit comments

Comments
 (0)