-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
67 lines (63 loc) · 2.02 KB
/
action.yml
File metadata and controls
67 lines (63 loc) · 2.02 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
name: devbox-preview
description: Create and destroy preview workspaces for pull requests
inputs:
action:
description: 'Action to perform: up or down'
required: true
server:
description: 'Target server hostname or pool name'
required: true
template:
description: 'Workspace template to use (optional)'
required: false
default: ''
devbox-version:
description: 'devbox version to install'
required: false
default: 'latest'
runs:
using: composite
steps:
- name: Install devbox
shell: bash
env:
DEVBOX_VERSION: ${{ inputs.devbox-version }}
run: |
if [ "$DEVBOX_VERSION" = "latest" ]; then
DOWNLOAD_URL="https://github.com/junixlabs/devbox/releases/latest/download/devbox-linux-amd64"
else
DOWNLOAD_URL="https://github.com/junixlabs/devbox/releases/download/${DEVBOX_VERSION}/devbox-linux-amd64"
fi
curl -fsSL "$DOWNLOAD_URL" -o /usr/local/bin/devbox
chmod +x /usr/local/bin/devbox
devbox --version
- name: Preview Up
if: inputs.action == 'up'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
INPUT_PR: ${{ github.event.pull_request.number }}
INPUT_REPO: ${{ github.repository }}
INPUT_SHA: ${{ github.event.pull_request.head.sha }}
INPUT_SERVER: ${{ inputs.server }}
INPUT_TEMPLATE: ${{ inputs.template }}
run: |
ARGS="--pr $INPUT_PR"
ARGS="$ARGS --repo $INPUT_REPO"
ARGS="$ARGS --sha $INPUT_SHA"
ARGS="$ARGS --server $INPUT_SERVER"
if [ -n "$INPUT_TEMPLATE" ]; then
ARGS="$ARGS --template $INPUT_TEMPLATE"
fi
devbox ci preview-up $ARGS
- name: Preview Down
if: inputs.action == 'down'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
INPUT_PR: ${{ github.event.pull_request.number }}
INPUT_REPO: ${{ github.repository }}
run: |
devbox ci preview-down \
--pr "$INPUT_PR" \
--repo "$INPUT_REPO"