-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 1.97 KB
/
ci.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
name: CI
on:
push:
tags: ["*"]
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v2
with:
repository: itering/actions
path: .github/actions
persist-credentials: false
ssh-key: "${{ secrets.ITERING_ACTIONS_DEPLOY_KEY }}"
- uses: actions/setup-go@v2
with:
go-version: ~1.17.0
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_IO_BOT_USERNAME }}
password: ${{ secrets.QUAY_IO_BOT_PASSWORD }}
registry: quay.io
- env:
CGO_ENABLED: 0
run: |
COMMIT=$(git rev-parse --short HEAD || true)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ" || true)
TAG=$(git describe --tags --abbrev=0 HEAD || true)
COMMIT=${COMMIT:-NO_COMMIT}
DATE=${DATE:-NO_DATE}
TAG=${TAG:-NO_TAG}
go get -u github.com/mitchellh/gox
gox -verbose \
-output "bin/{{.Dir}}_{{.OS}}_{{.Arch}}" \
-osarch "linux/amd64 linux/arm64 darwin/amd64" \
-ldflags "-X main.buildCommit=${COMMIT} \
-X main.buildDate=${DATE} \
-X main.buildVersion=${TAG}" \
./...
- uses: ./.github/actions/docker-build-deploy
with:
skip_deploy: true
docker_registry: quay.io
- if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG=$(git describe --tags --abbrev=0 HEAD)
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^)
RELEASE_NOTES=$(git log "$LAST_TAG..HEAD" --oneline --decorate)
go get -u github.com/tcnksm/ghr
ghr -b "${RELEASE_NOTES}" -t "${{ secrets.GITHUB_TOKEN }}" -u "${GITHUB_REPOSITORY%%/*}" -recreate "${TAG}" bin/