-
Notifications
You must be signed in to change notification settings - Fork 74
94 lines (90 loc) · 3.31 KB
/
release.yaml
File metadata and controls
94 lines (90 loc) · 3.31 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
---
name: Release
on:
push:
tags: ["*"]
jobs:
build:
name: Build
strategy:
matrix:
version: ['stable']
target:
- {os: 'darwin', platform: 'macos-latest', arch: 'amd64'}
- {os: 'darwin', platform: 'macos-latest', arch: 'arm64'}
- {os: 'linux', platform: 'ubuntu-latest', arch: 'amd64'}
- {os: 'linux', platform: 'ubuntu-latest', arch: 'arm64'}
- {os: 'windows', platform: 'windows-latest', arch: 'amd64'}
runs-on: ${{ matrix.target.platform }}
permissions:
contents: write
steps:
- name: Setup Go environment
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # ratchet:actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
check-latest: true
id: go
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- name: Build binary
run: |
go env -w CGO_ENABLED=0 GOARCH=${{ matrix.target.arch }}
go build -o certigo .
- name: Upload a Build Artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: certigo
release:
name: Create release
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- name: Create release
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # ratchet:actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Release Build (Draft)"
body: "Release Build (from ${{ github.ref }}/${{ github.sha }})"
draft: true
prerelease: true
add-assets:
name: Add assets
runs-on: ubuntu-latest
needs: [build, release]
permissions:
contents: write
strategy:
matrix:
target:
- {os: 'darwin', arch: 'amd64'}
- {os: 'darwin', arch: 'arm64'}
- {os: 'linux', arch: 'amd64'}
- {os: 'linux', arch: 'arm64'}
- {os: 'windows', arch: 'amd64'}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: dist
- name: Upload artifact to release
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # ratchet:actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./dist/certigo
asset_name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
asset_content_type: application/octet-stream