-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
93 lines (88 loc) · 2.83 KB
/
action.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: "Deploy with Bacon"
description: "Deploy DNS records with Bacon"
branding:
icon: cloud-lightning
color: red
inputs:
api-key:
description: "Porkbun API key"
required: true
secret-key:
description: "Porkbun secret key"
required: true
config:
description: "Config file to deploy"
required: true
create:
description: "Create new records"
required: false
delete:
description: "Delete outdated records"
required: false
version:
description: "Version of Bacon to download and use"
required: false
default: latest
runs:
using: "composite"
steps:
- name: Select tag
id: select-tag
shell: bash
run: |
tag_name="${{ inputs.version }}"
if [ "$tag_name" = "latest" ]; then
tag_name="$(curl -s "https://api.github.com/repos/jungaretti/bacon/releases/latest" | jq -r '.tag_name')"
fi
echo "Selected tag $tag_name"
echo "BACON_TAG_NAME=$tag_name" >> "$GITHUB_OUTPUT"
- name: Select asset
id: select-asset
shell: bash
env:
BACON_TAG_NAME: ${{ steps.select-tag.outputs.BACON_TAG_NAME }}
run: |
asset="bacon-$BACON_TAG_NAME-linux-amd64.tar.gz"
asset_url="https://github.com/jungaretti/bacon/releases/download/$BACON_TAG_NAME/$asset"
echo "Selected asset $asset at $asset_url"
echo "BACON_ASSET=$asset" >> "$GITHUB_OUTPUT"
echo "BACON_ASSET_URL=$asset_url" >> "$GITHUB_OUTPUT"
- name: Download asset
id: download-asset
shell: bash
env:
BACON_ASSET: ${{ steps.select-asset.outputs.BACON_ASSET }}
BACON_ASSET_URL: ${{ steps.select-asset.outputs.BACON_ASSET_URL }}
run: |
pushd "$(mktemp -d)"
wget $BACON_ASSET_URL -O $BACON_ASSET --progress=dot:mega
tar -xf $BACON_ASSET
bacon_bin="$(pwd)/bacon"
echo "Downloaded $bacon_bin"
echo "BACON_BIN_PATH=$bacon_bin" >> "$GITHUB_OUTPUT"
- name: bacon ping
shell: bash
env:
BACON_BIN_PATH: ${{ steps.download-asset.outputs.BACON_BIN_PATH }}
PORKBUN_API_KEY: ${{ inputs.api-key }}
PORKBUN_SECRET_KEY: ${{ inputs.secret-key }}
run: |
$BACON_BIN_PATH ping
- name: bacon deploy
shell: bash
env:
BACON_BIN_PATH: ${{ steps.download-asset.outputs.BACON_BIN_PATH }}
PORKBUN_API_KEY: ${{ inputs.api-key }}
PORKBUN_SECRET_KEY: ${{ inputs.secret-key }}
run: |
DELETE_FLAG=''
if [ "${{ inputs.delete }}" = 'true' ]; then
DELETE_FLAG='-d'
fi
echo "Selected delete flag $DELETE_FLAG"
CREATE_FLAG=''
if [ "${{ inputs.create }}" = 'true' ]; then
CREATE_FLAG='-c'
fi
echo "Selected create flag $CREATE_FLAG"
$BACON_BIN_PATH deploy ${{ inputs.config }} $DELETE_FLAG $CREATE_FLAG