|
| 1 | +name: Build and Release HTML-Attribute-Folder |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*' |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: write |
| 12 | + steps: |
| 13 | + - name: Maximize Build Space |
| 14 | + uses: easimon/maximize-build-space@v10 |
| 15 | + with: |
| 16 | + root-reserve-mb: 2048 |
| 17 | + swap-size-mb: 1024 |
| 18 | + remove-dotnet: true |
| 19 | + remove-android: true |
| 20 | + remove-haskell: true |
| 21 | + build-mount-path: /mnt/gradle-cache |
| 22 | + |
| 23 | + - name: Checkout project sources |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + fetch-tags: true |
| 28 | + ref: ${{ github.ref }} |
| 29 | + |
| 30 | + - name: Get the version |
| 31 | + id: versions |
| 32 | + run: echo "TAGGED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 33 | + |
| 34 | + - name: Validate version |
| 35 | + id: check_version |
| 36 | + run: | |
| 37 | + if [[ "${{ steps.versions.outputs.TAGGED_VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 38 | + echo "valid=true" >> $GITHUB_OUTPUT |
| 39 | + else |
| 40 | + echo "valid=false" >> $GITHUB_OUTPUT |
| 41 | + fi |
| 42 | +
|
| 43 | + - name: Build and Test |
| 44 | + uses: ./.github/actions/build |
| 45 | + with: |
| 46 | + version: ${{ steps.versions.outputs.TAGGED_VERSION }} |
| 47 | + |
| 48 | + - name: Create GitHub Release |
| 49 | + uses: ncipollo/release-action@v1 |
| 50 | + with: |
| 51 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + artifacts: "build/distributions/html-attribute-folder-*.zip" |
| 53 | + name: "Release v${{ steps.versions.outputs.TAGGED_VERSION }}" |
| 54 | + tag: "v${{ steps.versions.outputs.TAGGED_VERSION }}" |
| 55 | + prerelease: ${{ steps.check_version.outputs.valid != 'true' }} |
| 56 | + allowUpdates: true |
| 57 | + |
| 58 | + - name: Create IntelliJ's Marketplace Release |
| 59 | + # Publish only valid semantic (real) versions |
| 60 | + if: steps.check_version.outputs.valid == 'true' |
| 61 | + run: ./gradlew publishPlugin -PpluginVersion=${{ steps.versions.outputs.TAGGED_VERSION }} --no-configuration-cache --no-build-cache |
| 62 | + env: |
| 63 | + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }} |
| 64 | + GRADLE_USER_HOME: /mnt/gradle-cache |
| 65 | + GRADLE_OPTS: "-Dorg.gradle.configuration-cache=false -Dorg.gradle.caching=false" |
| 66 | + |
| 67 | + - name: Cleanup Tag on Failure |
| 68 | + if: failure() |
| 69 | + run: | |
| 70 | + echo "Build failed. Deleting tag v${{ steps.versions.outputs.TAGGED_VERSION }}..." |
| 71 | + git push --delete origin v${{ steps.versions.outputs.TAGGED_VERSION }} |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments