-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from 10up/enhancement/367
Added "Build release zip" Workflow.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build release zip | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build_zip: | ||
name: New release | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: npm install and build | ||
run: | | ||
npm install | ||
npm run build | ||
npm run makepot | ||
composer install --no-dev | ||
npm run archive | ||
- name: Upload the ZIP file as an artifact | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ github.event.repository.name }} | ||
path: release | ||
retention-days: 5 | ||
|
||
- name: Upload release asset | ||
if: ${{ github.event_name == 'release' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ${{github.workspace}}/${{ github.event.repository.name }}.zip | ||
asset_name: ${{ github.event.repository.name }}.zip | ||
asset_content_type: application/zip |