Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zip generation steps to output zip_path, Closes #34 #37

Merged
merged 1 commit into from
May 26, 2020
Merged

Add zip generation steps to output zip_path, Closes #34 #37

merged 1 commit into from
May 26, 2020

Conversation

shivapoudel
Copy link
Contributor

@shivapoudel shivapoudel commented May 6, 2020

Description of the Change

Add zip generation steps to output zip_path so it can be used for further other actions.

Alternate Designs

Generating zip is optional and it can be opt-in only with generate-zip true:

with:
  generate-zip: true

Benefits

It can be used for further other actions. See this workflow and watch the commented area:

name: Deploy to WordPress.org
on:
  release:
    types: [published]
jobs:
  tag:
    name: New tag
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Build # To build my project.
      run: |
        npm install
        npm run build
    - name: WordPress Plugin Deploy
      id: deploy # ID to supply in other steps.
      uses: 10up/action-wordpress-plugin-deploy@master
      with:
        generate-zip: true # boolean so users can opt-out of generation zip which is by default.
      env:
        SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
        SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
    - 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 }} # here to implement zip path from deploy step.
        asset_name: ${{ github.event.repository.name }}.zip
        asset_content_type: application/zip

Possible Drawbacks

None that I can think of.

Verification Process

I read through the entrypoint file in the Action referenced but otherwise just going to let it test by opening this PR and seeing what happens.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Closes #4

10up/actions-wordpress#8

Changelog Entry

Added - Zip generation steps to output zip_path.

@jeffpaul jeffpaul added this to the Future Release milestone May 7, 2020
@jeffpaul jeffpaul added the type:enhancement New feature or request. label May 7, 2020
@jeffpaul jeffpaul requested a review from helen May 7, 2020 02:27
@jeffpaul
Copy link
Member

jeffpaul commented May 7, 2020

@shivapoudel welcome to 10up's GitHub Actions and thanks for the PR, its greatly appreciated! I'm checking to get this through review to see if there are any questions or concerns that may require an update to the PR, but otherwise have milestoned this for Future Release while that code review progresses. Thanks again!

@helen
Copy link
Collaborator

helen commented May 26, 2020

Nice! I'll have to test/take a look at docs to see if the tag name is passed in the same format when using the release action instead of tag but this makes a lot of sense.

@helen helen merged commit d5acdd9 into 10up:develop May 26, 2020
@helen
Copy link
Collaborator

helen commented May 26, 2020

Alright I tried running this in my test repo but I got the following:

 Generating zip file...
	zip warning: name not matched: admin-color-scheme-fun-pack/

zip error: Nothing to do! (try: zip -r admin-color-scheme-fun-pack.zip . -i admin-color-scheme-fun-pack/)

I think the various paths are incorrect - this should probably store the ZIP in GITHUB_WORKSPACE and not navigate around as you're doing. Will reproduce locally and then open a PR to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add steps to example workflow around ZIP generation
3 participants