Skip to content

Commit

Permalink
ci: add upload to staging instance (#793)
Browse files Browse the repository at this point in the history
* ci: add upload to staging instance

* ci: allow manual deployment to either environment

* docs: update changelog
  • Loading branch information
ksted authored Nov 18, 2024
1 parent 193af6d commit 9554dec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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" }'
9 changes: 9 additions & 0 deletions docs/changelog/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9554dec

Please sign in to comment.