forked from prometheus-community/postgres_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (63 loc) · 1.83 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
name: CI
on:
push:
branches:
- master
tags:
- '**'
pull_request:
jobs:
calculate-tag:
uses: ./.github/workflows/calculate-tag.yaml
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Setup Golang
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
- name: Test
run: make test
build:
runs-on: ubuntu-latest
needs: [ calculate-tag, test ]
steps:
- name: Checkout Code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Setup Golang
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
- name: Build
run: make crossbuild
- name: Package
run: make crossbuild-tarballs
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: ./.build/*.tar.gz
publish:
runs-on: ubuntu-latest
needs: [ calculate-tag, build ]
permissions: write-all
if: contains(github.event.head_commit.message, 'pre-release') || startsWith(github.base_ref, '/refs/tags')
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
- name: Download artifacts
run: ls -ltr
- name: Create GH release
uses: softprops/action-gh-release@v1
id: release
with:
generate_release_notes: true
target_commitish: "${{ github.base_ref }}"
tag_name: ${{ needs.calculate-tag.outputs.tag }}
prerelease: "${{ github.event_name == 'pull_request' }}"
files: |
*.tar.gz