Repository navigation
68 lines (60 loc) · 2.33 KB
/
Copy pathdeploy_example_app.yml
File metadata and controls
68 lines (60 loc) · 2.33 KB
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
name: Deploy example app to Capgo
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
deploy:
if: ${{ github.event_name != 'release' || !github.event.release.prerelease }}
name: Deploy example app to Capgo
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name || github.ref }}
fetch-depth: 1
filter: blob:none
persist-credentials: false
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.4
no-cache: true
- name: Install plugin dependencies
run: bun install --frozen-lockfile
- name: Build example app
run: bun run example:build
- name: Compute unique bundle version
id: bundle
env:
RUN_NUMBER: ${{ github.run_number }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
# The example-app package.json version never changes, so derive the bundle
# version from the plugin version plus the run number and attempt. Every
# release and every manual rerun then uploads a new, semver-valid bundle.
plugin_version="$(jq -r '.version // empty' package.json)"
if [ -z "$plugin_version" ]; then
echo "::error::Root package.json has no version"
exit 1
fi
base="${plugin_version%%+*}"
case "$base" in
*-*) bundle="${base}.example.${RUN_NUMBER}.${RUN_ATTEMPT}" ;;
*) bundle="${base}-example.${RUN_NUMBER}.${RUN_ATTEMPT}" ;;
esac
echo "Example bundle version: ${bundle}"
echo "version=${bundle}" >> "$GITHUB_OUTPUT"
- name: Deploy to Capgo
working-directory: example-app
run: bunx @capgo/cli@latest bundle upload app.capgo.data.storage.sqlite --bundle "$BUNDLE_VERSION" --path dist --channel production --package-json package.json,../package.json --node-modules node_modules,../node_modules --delta --no-key --ignore-checksum-check --apikey "$CAPGO_TOKEN"
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
BUNDLE_VERSION: ${{ steps.bundle.outputs.version }}