-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
91 lines (84 loc) · 2.81 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
name: 'Deploy to Jamsocket'
description: 'This action will handle deploying session backend code to your Jamsocket service.'
inputs:
jamsocket_api_token:
description: 'API Token for Jamsocket authentication'
required: true
jamsocket_account:
description: 'Name of your Jamsocket account'
required: true
jamsocket_service:
description: 'Name of your Jamsocket service'
required: true
jamsocket_registry_url:
description: 'Custom Jamsocket Registry URL - should not be used'
required: false
default: 'registry.jamsocket.com'
docker_build_context:
description: 'Path to your Docker build context'
required: true
docker_additional_build_contexts:
description: 'List of additional build contexts'
required: false
dockerfile_path:
description: 'Path to your Dockerfile'
required: true
tag:
description: 'Custom tag for your Docker image'
required: false
default: 'latest'
push:
description: 'Whether to push the image after building'
required: false
default: true
runs:
using: 'composite'
steps:
- name: Set JAMCR_USER from token
shell: bash
run: |
JAMSOCKET_API_TOKEN=${{ inputs.jamsocket_api_token }}
JAMCR_USER="${JAMSOCKET_API_TOKEN%%.*}"
echo "JAMCR_USER=$JAMCR_USER" >> $GITHUB_ENV
- name: Set JAMCR_PASS from token
shell: bash
run: |
JAMSOCKET_API_TOKEN=${{ inputs.jamsocket_api_token }}
JAMCR_PASS="${JAMSOCKET_API_TOKEN#*.}"
echo "JAMCR_PASS=$JAMCR_PASS" >> $GITHUB_ENV
- name: Log into Jamsocket's Docker registry
uses: docker/login-action@v3
with:
registry: ${{ inputs.jamsocket_registry_url }}
username: ${{ env.JAMCR_USER }}
password: ${{ env.JAMCR_PASS }}
- name: Get commit message
shell: bash
run: |
echo 'COMMIT_MSG<<EOF' >> $GITHUB_ENV
git log -1 --pretty=%B >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.jamsocket_registry_url }}/${{ inputs.jamsocket_account }}/${{ inputs.jamsocket_service }}
tags: |
type=raw,value=${{ inputs.tag }}
labels: |
hash=${{ github.sha }}
message=${{ env.COMMIT_MSG }}
branch=${{ github.ref_name }}
repository=${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ inputs.docker_build_context }}
build-contexts: ${{ inputs.docker_additional_build_contexts }}
file: ${{ inputs.dockerfile_path }}
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
branding:
icon: 'check-circle'
color: 'blue'