Skip to content

fix(ci): replace archived upload-release-asset with gh CLI#1935

Open
faisalahammad wants to merge 1 commit into
xwp:developfrom
faisalahammad:fix/1526-gh-release-upload
Open

fix(ci): replace archived upload-release-asset with gh CLI#1935
faisalahammad wants to merge 1 commit into
xwp:developfrom
faisalahammad:fix/1526-gh-release-upload

Conversation

@faisalahammad

Copy link
Copy Markdown

Summary

Replace the archived actions/upload-release-asset@v1 step in the WP.org deploy workflow with gh release upload. The old action is unmaintained and triggers Node 12 deprecation warnings on every release run. Behavior stays the same: the zip from the 10up deploy action is still attached to the GitHub release as stream.zip.

Fixes #1526

Changes

.github/workflows/deploy-to-wp-org.yml

Before:

- name: Upload release asset
  uses: actions/upload-release-asset@v1
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    upload_url: ${{ github.event.release.upload_url }}
    asset_path: ${{ steps.deploy.outputs.zip-path }}
    asset_name: ${{ github.event.repository.name }}.zip
    asset_content_type: application/zip

After:

- name: Upload release asset
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    RELEASE_TAG: ${{ github.event.release.tag_name }}
    ZIP_PATH: ${{ steps.deploy.outputs.zip-path }}
    ASSET_NAME: ${{ github.event.repository.name }}.zip
  run: |
    gh release upload \
      "$RELEASE_TAG" \
      "$ZIP_PATH#$ASSET_NAME" \
      --clobber

Why: Drop the archived third-party action. gh is already on GitHub-hosted runners, and values go through env so expressions are not interpolated into the shell script.

Testing

Test 1: Disposable pre-release

  1. Publish a pre-release tag that includes this workflow change (e.g. v0.0.0-test-1526).
  2. Confirm Deploy to WordPress.org Repository runs on release: published.
  3. Check the run: WP.org deploy is dry-run, Upload release asset succeeds, no Node 12 / upload-release-asset warning.
  4. On the release page, confirm stream.zip is attached and downloads cleanly.
  5. Delete the disposable pre-release and tag.

Result: release asset uploads via gh; WP.org stays dry-run for pre-releases.

actions/upload-release-asset@v1 is archived and stuck on Node 12.
Use gh release upload instead so release zips still attach as stream.zip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate actions/upload-release-asset

1 participant