diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml index 94574c2ee..b721bf035 100644 --- a/.github/workflows/upload.yml +++ b/.github/workflows/upload.yml @@ -1,12 +1,20 @@ name: Deploy PWA on: - # release: - # types: [published] - # push: - # branches: [main] + release: + types: [published] + push: + branches: [main] workflow_dispatch: inputs: + environment: + description: 'The environment to deploy to' + type: choice + required: true + default: 'staging' + options: + - staging + - production tag-version: description: 'The tag version, branch name or SHA to checkout' required: true @@ -22,7 +30,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: ${{ inputs.tag-version }} + ref: ${{ inputs.tag-version || github.ref }} - name: Enable corepack run: corepack enable @@ -84,10 +92,20 @@ jobs: ./middleware outPath: pwa.tar.gz - - name: Upload File - id: upload + - name: Upload build to production + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && ${{ inputs.environment }} == 'production') + id: upload-production uses: JantHsueh/upload-file-action@1.0 with: url: 'https://pwapublish.plentysystems.com' forms: '{ "token": "${{ secrets.URL_ENDPOINT_TOKEN }}" }' fileForms: '{ "file": "pwa.tar.gz" }' + + - name: Upload build to staging + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && ${{ inputs.environment }} == 'staging') + id: upload-staging + uses: JantHsueh/upload-file-action@1.0 + with: + url: 'https://pwapublish.plentysystems.com' + forms: '{ "token": "${{ secrets.URL_ENDPOINT_TOKEN_STAGING }}" }' + fileForms: '{ "file": "pwa.tar.gz" }' diff --git a/docs/changelog/changelog_en.md b/docs/changelog/changelog_en.md index 6224bab47..d398dd93d 100644 --- a/docs/changelog/changelog_en.md +++ b/docs/changelog/changelog_en.md @@ -13,6 +13,15 @@ - Newsletter email confirmation - The default data for the homepage is now available for both English and German. +#### GitHub Action: Upload + +The **Upload** action now supports deploying the PWA to different environments: + +- Production: triggered manually or when creating a GitHub release +- Staging: triggered manually or when pushing a change to the `main` branch + +Each client supports two PWA instances. With this change, you can designate the live instance as the production environment and the preview instance as the staging environment. The production environment uses the GitHub Actions Secret `URL_ENDPOINT_TOKEN`; the staging environment uses the GitHub Actions Secret `URL_ENDPOINT_TOKEN_STAGING`. + ### 🩹 Fixed - Load more accurate images sizes for product page.