@@ -3,7 +3,7 @@ name: Maven Release
33on :
44 push :
55 tags :
6- - ' v*' # Trigger release on version tag, e.g., v1.0.0
6+ - ' v*.*.* ' # Matches version tags like v1.0.0
77
88env :
99 ACTION_NAMESPACE : pdfix
8383 - name : Upload to FTP
8484 run : |
8585 curl -T config.json ftp.pdfix.net/update-service/v1/actions/${{ env.ACTION_NAMESPACE }}/${{ env.ACTION_REPOSITORY }}/config.json --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs
86+
87+ - name : Prepare directory for versions repository
88+ run : mkdir -p pdfix-version-updates
89+
90+ - name : Checkout versions repository
91+ uses : actions/checkout@v4
92+ with :
93+ repository : pdfix/pdfix-version-updates
94+ path : pdfix-version-updates
95+ token : ${{ secrets.PAT_VERSIONS }}
96+ ref : main
97+ fetch-depth : 0
98+
99+ - name : Update action version and date in versions repository
100+ run : |
101+ cd pdfix-version-updates/v1
102+ TODAY=$(date +%Y-%m-%d)
103+ jq --indent 4 '(.["pdfix-actions"][] | select(.name == "${{ env.ACTION_NAMESPACE }}/${{ env.ACTION_REPOSITORY }}")) |= . + {
104+ "version": "${{ env.tag }}",
105+ "release_date": "'"$TODAY"'"
106+ }' versions.json > tmp.json
107+ mv tmp.json versions.json
108+ cat versions.json
109+
110+ - name : Commit and Push changes into versions repository
111+ run : |
112+ cd pdfix-version-updates
113+ git config user.name "PDFix Support"
114+ git config user.email "support@pdfix.net"
115+ git add v1/versions.json
116+ git commit -m "${{ env.ACTION_NAMESPACE }}/${{ env.ACTION_REPOSITORY }} ${{ env.tag }}"
117+ git push
118+
119+ - name : Tag latest commit with increment in versions repository
120+ run : |
121+ cd pdfix-version-updates
122+ git pull
123+ if git describe --exact-match --tags HEAD > /dev/null 2>&1; then
124+ echo "HEAD already has a tag — skipping tagging."
125+ else
126+ latest_tag=$(git tag -l "v*.*.*" | sort -V | tail -n 1)
127+ echo "Latest tag is: $latest_tag"
128+ version=${latest_tag#v}
129+ IFS='.' read -r major minor patch <<< "$version"
130+ patch=$((patch + 1))
131+ new_tag="v$major.$minor.$patch"
132+ git tag -a "$new_tag" -m "Release $new_tag"
133+ git push origin "$new_tag"
134+ echo "Tagged HEAD with: $new_tag"
135+ fi
0 commit comments