-
Notifications
You must be signed in to change notification settings - Fork 47
102 lines (80 loc) · 3.44 KB
/
package-releaser.yaml
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
name: ABC package builder
on:
release:
types: [published]
jobs:
packer:
strategy:
matrix:
os: ['linux', 'amd64', 'arm64', 'windows']
runs-on: ubuntu-latest
steps:
- name : clone ABC
uses: actions/checkout@v2
- name: Go environment
uses: actions/[email protected]
with:
go-version: 1.16.2
- name: Show directory before
run: ls ./ && echo $(pwd)
# building go package based on os version - we use release tag for version
- name: ABC Package for Linux and Darwin-amd64
if: ${{matrix.os == 'linux'}}
run: go build -o "abc-${{github.event.release.tag_name}}" ./cmd/abc/...
env:
GOOS: linux
GOARCH: amd64
- name: Package for Windows
if: ${{matrix.os == 'windows'}}
run: go build -o "abc-${{github.event.release.tag_name}}.exe" ./cmd/abc/...
env:
GOOS: windows
GOARCH: amd64
- name: Package for Darwin-Arm64
if: ${{matrix.os == 'arm64'}}
run: go build -o "abc-${{matrix.os}}-${{github.event.release.tag_name}}" ./cmd/abc/...
env:
GOOS: darwin
GOARCH: arm64
- name: Package for Darwin-AMD64
if: ${{matrix.os == 'amd64'}}
run: go build -o "abc-${{github.event.release.tag_name}}" ./cmd/abc/...
env:
GOOS: darwin
GOARCH: amd64
- name: show afer
run: ls -la && ls -la ./cmd/abc/
# creating zip files for each os
- name: Zip
run: sudo apt -y update && sudo apt -y install zip
- name: Packing into zip for Linux
if: ${{matrix.os == 'linux'}}
run: zip -r "abc-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "abc-${{github.event.release.tag_name}}"
- name: Packing into zip for windows
if: ${{matrix.os == 'windows'}}
run: zip -r "abc-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "abc-${{github.event.release.tag_name}}.exe"
- name: Packing into zip for Darwin-arm64
if: ${{matrix.os == 'arm64'}}
run: zip -r "abc-darwin-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "abc-${{matrix.os}}-${{github.event.release.tag_name}}"
- name: Packing into zip for Darwin-amd64
if: ${{matrix.os == 'amd64'}}
run: zip -r "abc-darwin-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "abc-${{github.event.release.tag_name}}"
- name: show where we are
run: echo $(pwd)
# Uploading the package to it's release based on release tag
- name: Upload binaries to release for Linux and windows
if: ${{matrix.os != 'amd64' && matrix.os != 'arm64'}}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.RELEASER}}
file: "abc-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
asset_name: "abc-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
tag: ${{github.event.release.tag_name}}
- name: Upload binaries to release for amd64 and arm64
if: ${{matrix.os == 'amd64' || matrix.os == 'arm64' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.RELEASER}}
file: "abc-darwin-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
asset_name: "abc-darwin-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
tag: ${{github.event.release.tag_name}}