generated from arundo/github-actions-deploy-pod-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
81 lines (72 loc) · 3.03 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
name: Setup for deploy
description: This sets up the build environment, logs into Azure, and sets the short SHA variable
inputs:
build-required:
description: Allow suppression of building images because they already exist
required: false
default: 'true'
client-id:
description: Azure clientId
required: true
client-secret:
description: Azure clientSecret
required: true
language:
description: node or dotnet allowed
required: true
language-version:
description: Desired version in quotes
required: true
nuget-token:
description: Nuget token if private packages
required: false
default: 'none'
subscription-id:
description: Azure subscriptionId
required: true
tenant-id:
description: Azure tenantId
required: true
outputs:
short-sha:
description: Seven character version of SHA
value: ${{ steps.short-sha.outputs.short-sha }}
runs:
using: "composite"
steps:
- name: Fail if invalid input
if: inputs.language != 'node' && inputs.language != 'dotnet'
run: exit 1
shell: bash
- name: Setup Node
if: inputs.language == 'node' && inputs.build-required == 'true'
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.language-version }}
- name: Setup .NET
if: inputs.language == 'dotnet' && inputs.nuget-token == 'none' && inputs.build-required == 'true'
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ inputs.language-version }}
- name: Setup .NET with token
if: inputs.language == 'dotnet' && inputs.nuget-token != 'none' && inputs.build-required == 'true'
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ inputs.language-version }}
source-url: https://nuget.pkg.github.com/arundo/index.json
env:
NUGET_AUTH_TOKEN: ${{inputs.nuget-token}}
- name: Install Nuget configuration so docker can use Arundo packages
if: inputs.language == 'dotnet' && inputs.nuget-token != 'none' && inputs.build-required == 'true'
uses: finnp/create-file-action@master
env:
FILE_NAME: "nuget.config"
FILE_DATA: "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration><packageSources><add key=\"nuget.org\" value=\"https://api.nuget.org/v3/index.json\" protocolVersion=\"3\" /><add key=\"github\" value=\"https://nuget.pkg.github.com/arundo/index.json\" /></packageSources><packageSourceCredentials><github><add key=\"Username\" value=\"usernameNotReallyRequired\" /><add key=\"ClearTextPassword\" value=\"${{ inputs.nuget-token }}\" /></github></packageSourceCredentials></configuration>"
- name: Login to Azure
uses: Azure/login@v1
with:
creds: '{"clientId":"${{ inputs.client-id }}","clientSecret":"${{ inputs.client-secret }}","subscriptionId":"${{ inputs.subscription-id }}","tenantId":"${{ inputs.tenant-id }}"}'
- name: Calculate github short sha
id: short-sha
run: echo "::set-output name=short-sha::$(git rev-parse --short HEAD)"
shell: bash