-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (77 loc) · 2.58 KB
/
release.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
82
83
84
85
86
87
88
89
90
name: Create Release on Tag
on:
push:
tags:
- 'v*'
jobs:
build_and_release:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
os: [ linux, windows, darwin ]
arch: [ amd64, arm64 ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build the binary for ${{ matrix.os }}-${{ matrix.arch }}
run: |
if [ "${{ matrix.os }}" == "windows" ]; then
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o "build/qasectl-${{ matrix.os }}-${{ matrix.arch }}.exe" ./cmd
else
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o "build/qasectl-${{ matrix.os }}-${{ matrix.arch }}" ./cmd
fi
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
build/qasectl-linux-amd64
build/qasectl-linux-arm64
build/qasectl-darwin-amd64
build/qasectl-darwin-arm64
build/qasectl-windows-amd64.exe
build/qasectl-windows-arm64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-docker-n-publish:
runs-on: ubuntu-latest
needs: build_and_release
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Define the tag for the Docker image
# actions/checkout is making a shallow copy, so unless it's a tag event,
# tag will be empty; in such case, use shortened commit SHA
id: tag
run: echo "TAG=$(git describe --tags || git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./build/Dockerfile
push: true
provenance: false
tags: ghcr.io/qase-tms/qase-cli:${{ env.TAG }},ghcr.io/qase-tms/qase-cli:latest
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ env.TAG }}