-
Notifications
You must be signed in to change notification settings - Fork 5
130 lines (118 loc) · 4.54 KB
/
reusable.yml
File metadata and controls
130 lines (118 loc) · 4.54 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Reusable Workflow
on:
workflow_call:
inputs:
version:
required: true
type: string
environment:
required: true
type: string
is-production:
required: true
type: boolean
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Inject secrets and build
env:
LOKI_USERNAME: ${{ secrets.LOKI_USERNAME }}
LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
MIMIR_USERNAME: ${{ secrets.MIMIR_USERNAME }}
MIMIR_PASSWORD: ${{ secrets.MIMIR_PASSWORD }}
HOSSTED_AUTH_TOKEN: ${{ secrets.HOSSTED_AUTH_TOKEN }}
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_DEV_URL: ${{ secrets.LOKI_DEV_URL }}
HOSSTED_API_URL: ${{ secrets.HOSSTED_API_URL }}
HOSSTED_DEV_API_URL: ${{ secrets.HOSSTED_DEV_API_URL }}
MIMIR_URL: ${{ secrets.MIMIR_URL }}
MIMIR_DEV_URL: ${{ secrets.MIMIR_DEV_URL }}
HOSSTED_DEV_CLIENT_ID: ${{ secrets.HOSSTED_DEV_CLIENT_ID }}
HOSSTED_CLIENT_ID: ${{ secrets.HOSSTED_CLIENT_ID }}
HOSSTED_DEV_AUTH_URL: ${{ secrets.HOSSTED_DEV_AUTH_URL }}
HOSSTED_AUTH_URL: ${{ secrets.HOSSTED_AUTH_URL }}
COMMIT_HASH: ${{ github.sha }}
VERSION: ${{ inputs.version }}
ENVIRONMENT: ${{ inputs.environment }}
run: |
if [ "${{ inputs.is-production }}" == "true" ]; then
make -f Makefile linux && cp bin/linux/hossted-linux-amd64 bin/linux/hossted-${{ inputs.version }}-linux-amd64
make -f Makefile osx && cp bin/osx/hossted-darwin-amd64 bin/osx/hossted-${{ inputs.version }}-darwin-amd64
make -f Makefile windows && cp bin/windows/hossted.exe bin/windows/hossted-${{ inputs.version }}.exe
else
make -f Makefile linux-dev
make -f Makefile osx-dev
make -f Makefile windows-dev
fi
- name: Test Version of binary file
run: |
echo "Checking version of binary file..."
if [ "${{ inputs.is-production }}" == "true" ]; then
chmod 777 bin/linux/hossted-linux-amd64 && ./bin/linux/hossted-linux-amd64 version
else
chmod 777 bin/dev/hossted-dev-linux-amd64 && ./bin/dev/hossted-dev-linux-amd64 version
fi
- name: Upload Linux binary
if: ${{ inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-${{ inputs.version }}-linux-amd64
path: ./bin/linux/hossted-${{ inputs.version }}-linux-amd64
if-no-files-found: error
- name: Upload OSx binary
if: ${{ inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-${{ inputs.version }}-darwin-amd64
path: ./bin/osx/hossted-${{ inputs.version }}-darwin-amd64
if-no-files-found: error
- name: Upload Windowsx binary
if: ${{ inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-${{ inputs.version }}.exe
path: ./bin/windows/hossted-${{ inputs.version }}.exe
if-no-files-found: error
- name: Upload Linux DEV binary
if: ${{ !inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-dev-linux-amd64
path: ./bin/dev/hossted-dev-linux-amd64
if-no-files-found: error
- name: Upload OSx DEV binary
if: ${{ !inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-dev-darwin-amd64
path: ./bin/dev/hossted-dev-darwin-amd64
if-no-files-found: error
- name: Upload Windowsx DEV binary
if: ${{ !inputs.is-production }}
uses: actions/upload-artifact@v4
with:
name: hossted-dev.exe
path: ./bin/dev/hossted-dev.exe
if-no-files-found: error
- name: Create GitHub Release
if: ${{ inputs.is-production }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
files: |
./bin/linux/hossted-${{ inputs.version }}-linux-amd64
./bin/osx/hossted-${{ inputs.version }}-darwin-amd64
name: Release ${{ github.ref_name }}
body: |
Automated release created for tag ${{ github.ref_name }}.
This release includes the latest production build.
draft: true
generate_release_notes: true
prerelease: false