-
Notifications
You must be signed in to change notification settings - Fork 70
89 lines (81 loc) · 2.73 KB
/
release-artifacts.yml
File metadata and controls
89 lines (81 loc) · 2.73 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
name: Create Release Artifacts
on:
workflow_call:
inputs:
name:
required: true
type: string
tag:
required: true
type: string
secrets:
registry:
required: true
user:
required: true
password:
required: true
token:
required: true
jobs:
release-assets-matrix:
name: Release Matrix
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ linux ]
architecture:
- amd64
- arm64
- ppc64le
- s390x
steps:
- name: Docker Login
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ secrets.registry }}
username: ${{ secrets.user }}
password: ${{ secrets.password }}
- name: Extract executable
uses: shrink/actions-docker-extract@04c17c51a5b9fd93b7aed2e05e86c8fe2d90ee52 # v3.1.0
id: extract
with:
image: ${{ secrets.registry }}/${{ inputs.name }}:${{ inputs.tag }}-${{ matrix.platform }}-${{ matrix.architecture }}
path: /usr/local/bin/preflight
- name: Rename and upload the binary
run: |
mv --verbose "${outputs_dir}/preflight" "${outputs_dir}/preflight-${platform}-${architecture}"
gh release upload --repo "${GITHUB_REPOSITORY}" "${tag}" "${outputs_dir}/preflight-${platform}-${architecture}"
env:
outputs_dir: ${{ steps.extract.outputs.destination }}
platform: ${{ matrix.platform }}
architecture: ${{ matrix.architecture }}
tag: ${{ inputs.tag }}
GH_TOKEN: ${{ secrets.token }}
# builds mac binaries in parallel using matrix strategy
add-darwin-bins:
name: Release binaries for MacOS
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64, arm64]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set Env Tags
run: echo "RELEASE_TAG=$(echo "${GITHUB_REF}" | cut -d '/' -f 3)" >> "${GITHUB_ENV}"
- name: Install system deps
run: 'sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev'
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
- name: Build Mac binary for ${{ matrix.architecture }}
run: make build-mac-${{ matrix.architecture }}
- name: Upload binary to the release
run:
gh release upload --repo "${GITHUB_REPOSITORY}" "${tag}" preflight-darwin-${{ matrix.architecture }}
env:
tag: ${{ inputs.tag }}
GH_TOKEN: ${{ secrets.token }}