Deploy PWA #94
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: Deploy PWA | |
on: | |
# release: | |
# types: [published] | |
# push: | |
# branches: [main] | |
workflow_dispatch: | |
inputs: | |
tag-version: | |
description: 'The tag version, branch name or SHA to checkout' | |
required: true | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.tag-version }} | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.5' | |
cache: 'yarn' | |
registry-url: 'https://npm.pkg.github.com' | |
- name: Set yarn version | |
run: | | |
yarn set version stable | |
yarn set version 3.6.4 | |
- name: Setup .yarnrc.yml | |
run: | | |
yarn config set nodeLinker node-modules | |
yarn config set npmScopes.plentymarkets.npmRegistryServer "https://npm.pkg.github.com" | |
yarn config set npmScopes.plentymarkets.npmAlwaysAuth true | |
yarn config set npmScopes.plentymarkets.npmAuthToken $NODE_AUTH_TOKEN | |
yarn plugin import workspace-tools | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Dependencies | |
run: yarn --frozen-lockfile | |
- name: Setup environment | |
run: | | |
touch apps/web/.env | |
cat <<EOT >> apps/web/.env | |
API_URL=${{ vars.API_URL }} | |
API_SECURITY_TOKEN=${{ secrets.API_SECURITY_TOKEN }} | |
${{ vars.CONFIG }} | |
EOT | |
- name: Build | |
run: yarn build | |
- name: Install productive dependencies for server | |
run: yarn workspaces focus --production | |
- name: Copy Middleware Server | |
run: | | |
mkdir middleware | |
cp -r node_modules middleware | |
cp -r apps/server middleware | |
- name: Compress repo to Tar | |
uses: a7ul/[email protected] | |
id: compress | |
with: | |
command: c | |
cwd: ./ | |
files: | | |
./apps/web/.output | |
./middleware | |
outPath: pwa.tar.gz | |
- name: Upload File | |
id: upload | |
uses: JantHsueh/[email protected] | |
with: | |
url: 'https://pwapublish.plentysystems.com' | |
forms: '{ "token": "${{ secrets.URL_ENDPOINT_TOKEN }}" }' | |
fileForms: '{ "file": "pwa.tar.gz" }' |