|
| 1 | +name: Manually promote last prerelease to release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version to promote' |
| 8 | + required: true |
| 9 | + version-bump: |
| 10 | + description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release' |
| 11 | + required: true |
| 12 | + type: choice |
| 13 | + options: |
| 14 | + - 'patch' |
| 15 | + - 'minor' |
| 16 | + - 'major' |
| 17 | + |
| 18 | +jobs: |
| 19 | + manually_promote_release: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Verify input version is prerelease |
| 23 | + run: | |
| 24 | + if [[ "${{ github.event.inputs.version }}" != *"pre"* ]]; then |
| 25 | + echo "Version must be a prerelease" |
| 26 | + exit 1 |
| 27 | + fi |
| 28 | + - name: Get release info |
| 29 | + id: get-release |
| 30 | + uses: cardinalby/git-get-release-action@v1 |
| 31 | + env: |
| 32 | + GITHUB_TOKEN: ${{ github.token }} |
| 33 | + with: |
| 34 | + tag: ${{ github.event.inputs.version }} |
| 35 | + |
| 36 | + - uses: actions/checkout@v3 |
| 37 | + with: |
| 38 | + ref: ${{ steps.get-release.outputs.tag_name }} |
| 39 | + |
| 40 | + - uses: actions/setup-java@v3 |
| 41 | + with: |
| 42 | + java-version: '11' |
| 43 | + distribution: 'adopt' |
| 44 | + cache: gradle |
| 45 | + |
| 46 | + - name: Validate Gradle wrapper |
| 47 | + uses: gradle/wrapper-validation-action@v1 |
| 48 | + |
| 49 | + - name: Remove prerelease tag |
| 50 | + run: | |
| 51 | + echo "Removing prerelease tag from version" |
| 52 | + echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV |
| 53 | + - name: Build |
| 54 | + uses: gradle/gradle-build-action@v2 |
| 55 | + with: |
| 56 | + arguments: clean build -x test -x checkstyleMain -x checkstyleTest |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + GITHUB_VERSION: ${{ env.VERSION }} |
| 60 | + |
| 61 | + - name: Create release |
| 62 | + id: release |
| 63 | + uses: Multiverse/release-on-push-action@skip_prs |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + with: |
| 67 | + bump_version_scheme: ${{ github.event.inputs.version-bump }} |
| 68 | + tag_prefix: '' |
| 69 | + release_name: "<RELEASE_VERSION>" |
| 70 | + use_github_release_notes: true |
| 71 | + ref: ${{ steps.get-release.outputs.target_commitish }} |
| 72 | + skip_prs: true |
| 73 | + |
| 74 | + - name: Publish package |
| 75 | + uses: gradle/gradle-build-action@v2 |
| 76 | + with: |
| 77 | + arguments: publish |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + GITHUB_VERSION: ${{ env.VERSION }} |
| 81 | + |
| 82 | + - name: Upload release artifact |
| 83 | + uses: svenstaro/upload-release-action@v2 |
| 84 | + with: |
| 85 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + file: build/libs/multiverse-portals-${{ env.VERSION }}.jar |
| 87 | + asset_name: multiverse-portals-${{ steps.release.outputs.tag_name }}.jar |
| 88 | + tag: ${{ steps.release.outputs.tag_name }} |
0 commit comments