Fix workflow #52
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
name: NodeJS with Webpack | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- id: set_var | |
run: | | |
content=`cat ./package.json` | |
# the following lines are only required for multi line json | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=packageJson::$content" | |
- name: Build | |
run: | | |
export NODE_ENV=production | |
yarn | |
yarn build | |
mv static dist | |
zip -r static.zip dist | |
mkdir -p dist/.github/workflows/ | |
cp .github/workflows/* dist/.github/workflows/ | |
- name: Create Draft Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{fromJson(steps.set_var.outputs.packageJson).version}} | |
release_name: ${{fromJson(steps.set_var.outputs.packageJson).version}} | |
draft: true | |
prerelease: false | |
- uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./static.zip | |
asset_name: static.zip | |
asset_content_type: application/zip | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist |