|
24 | 24 | packages: write |
25 | 25 |
|
26 | 26 | steps: |
| 27 | + - name: Validate version input |
| 28 | + id: validation |
| 29 | + env: |
| 30 | + INPUT_RELEASE_VERSION: ${{ inputs.version }} |
| 31 | + INPUT_SNAPSHOT_VERSION: ${{ inputs.snapshot }} |
| 32 | + run: | |
| 33 | + if ! [[ "$INPUT_RELEASE_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then |
| 34 | + echo "Invalid version"; |
| 35 | + exit 1; |
| 36 | + fi |
| 37 | +
|
| 38 | + if ! [[ "$INPUT_SNAPSHOT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-SNAPSHOT)?$ ]]; then |
| 39 | + echo "Invalid snapshot version"; |
| 40 | + exit 1; |
| 41 | + fi |
| 42 | +
|
| 43 | + echo "release_version=$INPUT_RELEASE_VERSION" >> "$GITHUB_OUTPUT" |
| 44 | + echo "snapshot_version=$INPUT_SNAPSHOT_VERSION" >> "$GITHUB_OUTPUT" |
| 45 | +
|
27 | 46 | - name: Checkout |
28 | 47 | uses: actions/checkout@v4 |
29 | 48 |
|
@@ -53,21 +72,21 @@ jobs: |
53 | 72 |
|
54 | 73 | - name: Get Snapshot versions |
55 | 74 | id: snapshotVersions |
56 | | - run: ./scripts/get_snapshot_versions.sh ${{ inputs.snapshot }} |
| 75 | + run: ./scripts/get_snapshot_versions.sh ${{ steps.validation.outputs.snapshot_version }} |
57 | 76 |
|
58 | 77 | - name: Prepare for release metadata |
59 | 78 | shell: bash |
60 | 79 | run: | |
61 | | - sed -i.bak "s/${{ steps.snapshotVersions.outputs.cur_snapshot_version }}/${{ inputs.version }}/g" gradle.properties |
| 80 | + sed -i.bak "s/${{ steps.snapshotVersions.outputs.cur_snapshot_version }}/${{ steps.validation.outputs.release_version }}/g" gradle.properties |
62 | 81 |
|
63 | | - - name: Commit gradle.properties and set tag for v${{ inputs.version }} |
| 82 | + - name: Commit gradle.properties and set tag for v${{ steps.validation.outputs.release_version }} |
64 | 83 | uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2 |
65 | 84 | with: |
66 | 85 | add: 'gradle.properties' |
67 | | - message: 'Prepare for release: ${{ inputs.version }}' |
68 | | - tag: v${{ inputs.version }} |
| 86 | + message: 'Prepare for release: ${{ steps.validation.outputs.release_version }}' |
| 87 | + tag: v${{ steps.validation.outputs.release_version }} |
69 | 88 |
|
70 | | - - name: Deploy v${{ inputs.version }} |
| 89 | + - name: Deploy v${{ steps.validation.outputs.release_version }} |
71 | 90 | run: ./gradlew publish |
72 | 91 | env: |
73 | 92 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_SONATYPE_REPO_USERNAME }} |
|
79 | 98 | shell: bash |
80 | 99 | run: | |
81 | 100 | echo "Setting next snapshot version ${{ steps.snapshotVersions.outputs.new_snapshot_version }}" |
82 | | - sed -i.bak "s/${{ inputs.version }}/${{ steps.snapshotVersions.outputs.new_snapshot_version }}/g" gradle.properties |
| 101 | + sed -i.bak "s/${{ steps.validation.outputs.release_version }}/${{ steps.snapshotVersions.outputs.new_snapshot_version }}/g" gradle.properties |
83 | 102 |
|
84 | 103 | - name: Commit gradle.properties for Snapshot version ${{ steps.snapshotVersions.outputs.new_snapshot_version }} |
85 | 104 | uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2 |
|
96 | 115 | uses: softprops/action-gh-release@v2 |
97 | 116 | with: |
98 | 117 | generate_release_notes: true |
99 | | - tag_name: v${{ inputs.version }} |
| 118 | + tag_name: v${{ steps.validation.outputs.release_version }} |
0 commit comments