forked from Shopify/hydrogen
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.47 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This Action is responsible for deploying the default Hydrogen template to Oxygen.
# It is split out from deployments.yml because Oxygen checks for the presence of this specific workflow in the repo.
# TODO: Merge the workflow if/when Oxygen is more lenient.
# Don't change the line below!
#! oxygen_storefront_id: 28966968
name: Oxygen Deployment
on: [push, workflow_dispatch]
jobs:
deploy:
name: Deploy to Oxygen
if: ${{ github.repository_owner == 'shopify' }}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: 📥 Install dependencies
run: npm ci
# Enabling the turbo cache causes deployments to fail intermittently.
# The build step fails with dependency issues. More investigation needed.
# - name: 💾 Turbo cache
# id: turbo-cache
# uses: actions/cache@v3
# with:
# path: |
# node_modules/.cache/turbo
# **/.turbo
# key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
# restore-keys: |
# turbo-${{ github.job }}-${{ github.ref_name }}-
- name: 📦 Build packages
run: |
CI=true npm run build:pkg
- name: 📤 Build and publish the Demo store template to Oxygen
id: deploy
uses: shopify/oxygenctl-action@v4
with:
path: ./templates/demo-store
oxygen_deployment_token: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_28966968 }}
oxygen_worker_dir: dist/worker
oxygen_client_dir: dist/client
build_command: 'HYDROGEN_ASSET_BASE_URL=$OXYGEN_ASSET_BASE_URL npm run build'
# Hardcode message and timestamp if manual dispatch
commit_message: ${{ github.event.head_commit.message || 'Manual deployment' }}
commit_timestamp: ${{ github.event.head_commit.timestamp || github.event.repository.updated_at }}
oxygen_health_check: true
- name: 🐙 Create GitHub deployment
uses: shopify/github-deployment-action@v1
if: always()
with:
token: ${{ github.token }}
environment: 'preview'
preview_url: ${{ steps.deploy.outputs.url }}
description: ${{ github.event.head_commit.message }}