Changeset 19061 in josm for trunk/.github/workflows


Ignore:
Timestamp:
2024-04-26T16:00:41+02:00 (7 months ago)
Author:
taylor.smock
Message:

Fix #23643: Move to supported actions for GitHub ant workflow to remove node16 deprecation warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/ant.yml

    r19059 r19061  
    1515    name: Create Release
    1616    runs-on: ubuntu-latest
     17    permissions:
     18      contents: write # Needed to create actual release
    1719    env:
    1820      LANG: en_US.UTF-8
     
    4951      - name: Create release
    5052        id: create_release
    51         uses: actions/create-release@v1
    52         env:
    53           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
     53        uses: softprops/action-gh-release@v2
    5454        with:
    5555          tag_name: ${{ env.josm_release_tag }}
    56           release_name: JOSM release ${{ env.josm_release_tag }}
     56          name: JOSM release ${{ env.josm_release_tag }}
    5757          body: |
    5858            JOSM release ${{ env.josm_release_tag }}
    5959          draft: false
    6060          prerelease: ${{ env.josm_prerelease }}
    61         if: github.ref == 'refs/heads/master'
    6261
    6362  build:
     
    137136        if: ${{ always() && needs.createrelease.outputs.upload_url }}
    138137        env:
    139           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    140         uses: actions/upload-release-asset@v1
    141         with:
    142           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    143           asset_path: dist/josm-custom.jar
    144           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.jar
    145           asset_content_type: application/java-archive
     138          ASSET: dist/josm-custom.jar
     139          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.jar
     140          CONTENT_TYPE: application/java-archive
     141          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     142        # Use `gh api` instead of `gh release upload` so we can set the content type -- it also lets us avoid renaming files
     143        run: |
     144          gh api --verbose --method POST \
     145            --header "Accept: application/vnd.github+json" \
     146            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     147            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     148            --header "X-GitHub-Api-Version: 2022-11-28" \
     149            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     150            --input "${{ env.ASSET }}"
    146151
    147152      - name: Build and package for macOS
     
    194199      - name: Upload macOS app
    195200        if: ${{ runner.os == 'macos' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }}
    196         uses: actions/upload-release-asset@v1
    197         env:
    198           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    199         with:
    200           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    201           asset_path: app/JOSM.zip
    202           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.zip
    203           asset_content_type: application/zip
     201        env:
     202          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     203          CONTENT_TYPE: application/zip
     204          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.create_revision.outputs.josm_release_tag }}.zip
     205        run: |
     206          curl --location \
     207            --request POST \
     208            --header "Accept: application/vnd.github+json" \
     209            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     210            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     211            --header "X-GitHub-Api-Version: 2022-11-28" \
     212            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     213            --data-binary "@app/JOSM.zip"
    204214
    205215      - name: Upload macOS app (x64)
    206216        if: ${{ runner.os == 'macos' && matrix.java != '11' && always() && runner.arch == 'ARM64' && needs.createrelease.outputs.upload_url }}
    207         uses: actions/upload-release-asset@v1
    208         env:
    209           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    210         with:
    211           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    212           asset_path: app/JOSM_${{ matrix.java }}_x86_64.zip
    213           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-x64.zip
    214           asset_content_type: application/zip
     217        env:
     218          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.create_revision.outputs.josm_release_tag }}-x64.zip
     219          CONTENT_TYPE: application/zip
     220          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     221        # Use `curl` instead of `gh release upload` so we can set the content type
     222        run: |
     223          curl --location \
     224            --request POST \
     225            --header "Accept: application/vnd.github+json" \
     226            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     227            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     228            --header "X-GitHub-Api-Version: 2022-11-28" \
     229            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     230            --data-binary "@app/JOSM_${{ matrix.java }}_x86_64.zip"
    215231
    216232      - name: Upload macOS app (aarch64)
    217233        if: ${{ runner.os == 'macos' && matrix.java != '11' && always() && runner.arch == 'ARM64' && needs.createrelease.outputs.upload_url }}
    218         uses: actions/upload-release-asset@v1
    219         env:
    220           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    221         with:
    222           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    223           asset_path: app/JOSM_${{ matrix.java }}_arm64.zip
    224           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-aarch64.zip
    225           asset_content_type: application/zip
     234        env:
     235          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.create_revision.outputs.josm_release_tag }}-aarch64.zip
     236          CONTENT_TYPE: application/zip
     237          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     238        # Use `curl` instead of `gh release upload` so we can set the content type
     239        run: |
     240          curl --location \
     241            --request POST \
     242            --header "Accept: application/vnd.github+json" \
     243            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     244            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     245            --header "X-GitHub-Api-Version: 2022-11-28" \
     246            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     247            --data-binary "@app/JOSM_${{ matrix.java }}_arm64.zip"
    226248
    227249      - name: Upload Windows Installer executable
    228250        if: ${{ runner.os == 'windows' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }}
    229         uses: actions/upload-release-asset@v1
    230         env:
    231           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    232         with:
    233           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    234           asset_path: app/JOSM.exe
    235           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.exe
    236           asset_content_type: application/vnd.microsoft.portable-executable
     251        env:
     252          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.exe
     253          CONTENT_TYPE: application/vnd.microsoft.portable-executable
     254          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     255        # Use `curl` instead of `gh release upload` so we can set the content type
     256        run: |
     257          curl --location \
     258            --request POST \
     259            --header "Accept: application/vnd.github+json" \
     260            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     261            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     262            --header "X-GitHub-Api-Version: 2022-11-28" \
     263            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     264            --data-binary "@app/JOSM.exe"
    237265
    238266      - name: Upload Windows Installer package
    239267        if: ${{ runner.os == 'windows' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }}
    240         uses: actions/upload-release-asset@v1
    241         env:
    242           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    243         with:
    244           upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
    245           asset_path: app/JOSM.msi
    246           asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.msi
    247           asset_content_type: application/x-ole-storage
     268        env:
     269          ASSET_NAME: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.msi
     270          CONTENT_TYPE: application/x-ole-storage
     271          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     272        # Use `curl` instead of `gh release upload` so we can set the content type
     273        run: |
     274          curl --location \
     275            --request POST \
     276            --header "Accept: application/vnd.github+json" \
     277            --header "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
     278            --header "Content-Type: ${{ env.CONTENT_TYPE }}" \
     279            --header "X-GitHub-Api-Version: 2022-11-28" \
     280            "$(sed 's/{?name,label}/?name=${{ env.ASSET_NAME }}/g' <<< ${{ needs.createrelease.outputs.upload_url }})" \
     281            --data-binary "@app/JOSM.msi"
Note: See TracChangeset for help on using the changeset viewer.