Skip to content

Commit

Permalink
TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Dec 13, 2023
1 parent c9254cf commit f675512
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/webapp_build_bundle_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build WebApp Bundle

on:
release:
types: [published]

workflow_dispatch:

jobs:
check:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest

outputs:
release_upload_url: ${{ steps.get_release.outputs.upload_url }}
release_tag_name: ${{ steps.get_release.outputs.tag_name }}

steps:
- name: Get Release for tag ${{ github.ref_name }}
id: get_release
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}


build:
needs: [check]
runs-on: ubuntu-latest
if: ${{ needs.check.outputs.release_upload_url != '' }} && ${{ needs.check.outputs.release_tag_name != '' }}

env:
WEBAPP_ROOT_PATH: ./src/webapp

outputs:
release_upload_url: ${{ needs.check.outputs.release_upload_url }}
webapp_bundle_name: ${{ steps.vars.outputs.webapp_bundle_name }}

steps:
- name: Set Output vars
id: vars
run: |
echo "webapp_bundle_name=webapp-${{ needs.check.outputs.release_tag_name }}.tar.gz" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: npm install
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
run: npm install
- name: npm build
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
env:
CI: false
run: npm run build

- name: Create Bundle
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
run: |
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build
- name: Artifact Upload
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.webapp_bundle_name }}
path: ${{ env.WEBAPP_ROOT_PATH }}/${{ steps.vars.outputs.webapp_bundle_name }}
retention-days: 5

upload:
needs: [build]
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Artifact Download
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.webapp_bundle_name }}

- name: Upload Release Asset
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build.outputs.release_upload_url }}
asset_name: ${{ needs.build.outputs.webapp_bundle_name }}
asset_path: ${{ needs.build.outputs.webapp_bundle_name }}
asset_content_type: application/gzip

0 comments on commit f675512

Please sign in to comment.