forked from anti1869/riak_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.97 KB
/
ci.yml
File metadata and controls
69 lines (57 loc) · 1.97 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
---
name: ci
permissions:
contents: write
on:
# for feature branches
pull_request:
# for releases
push:
branches:
- master
concurrency:
group: ${{ (github.ref != 'refs/heads/master') && format('{0}-{1}', github.ref, github.workflow) || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
ci:
name: ci
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- run: |
IMAGE_NAME=riak_exporter:latest
CONTAINER_NAME=riak_exporter
PPORT=8097
docker buildx build . --load --tag "${IMAGE_NAME}"
docker run --detach --rm --name "${CONTAINER_NAME}" -p "${PPORT}":8097 "${IMAGE_NAME}"
sleep 5
METRICS=$(curl localhost:"${PPORT}")
EXPECTED="<a href=\"/metrics\">/metrics</a>"
if [[ "${METRICS}" != "${EXPECTED}" ]]; then
echo "curl returned ${METRICS}, but we expected ${EXPECTED}!"
exit 1
else
docker stop "${CONTAINER_NAME}"
echo "All good!"
fi
release:
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'no-release') == false
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}}
- name: Bump version and push tag
id: tag-version
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
release_branches: master
- name: Create a GitHub release
run: |
gh release create ${{ steps.tag-version.outputs.new_tag }} --generate-notes --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}