| 1 |
name: Release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: |
| 6 |
- 'v*' |
| 7 |
|
| 8 |
jobs: |
| 9 |
release-binaries: |
| 10 |
runs-on: ubuntu-latest |
| 11 |
|
| 12 |
steps: |
| 13 |
- name: Checkout code |
| 14 |
uses: actions/checkout@v6 |
| 15 |
|
| 16 |
- name: Setup Go |
| 17 |
uses: actions/setup-go@v6 |
| 18 |
with: |
| 19 |
go-version: '1.26' |
| 20 |
|
| 21 |
- name: Build binaries |
| 22 |
run: | |
| 23 |
make build-all-binaries |
| 24 |
ls -la |
| 25 |
ls -la .build/ |
| 26 |
./package-github-binaries.sh |
| 27 |
ls -la dist/ |
| 28 |
|
| 29 |
- name: Add binaries to release |
| 30 |
uses: ncipollo/release-action@v1 |
| 31 |
with: |
| 32 |
artifacts: "dist/*" |
| 33 |
allowUpdates: true |
| 34 |
omitBodyDuringUpdate: true |
| 35 |
|
| 36 |
|
| 37 |
build-and-push-docker-images: |
| 38 |
runs-on: ubuntu-latest |
| 39 |
permissions: |
| 40 |
contents: read |
| 41 |
packages: write |
| 42 |
attestations: write |
| 43 |
id-token: write |
| 44 |
|
| 45 |
steps: |
| 46 |
- name: Checkout code |
| 47 |
uses: actions/checkout@v6 |
| 48 |
|
| 49 |
- name: Set up QEMU |
| 50 |
uses: docker/setup-qemu-action@v4 |
| 51 |
|
| 52 |
- name: Set up Docker Buildx |
| 53 |
uses: docker/setup-buildx-action@v4 |
| 54 |
|
| 55 |
- name: Login to Docker Hub |
| 56 |
uses: docker/login-action@v4 |
| 57 |
with: |
| 58 |
username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 59 |
password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 60 |
|
| 61 |
- name: Login to ghcr.io |
| 62 |
uses: docker/login-action@v4 |
| 63 |
with: |
| 64 |
registry: ghcr.io |
| 65 |
username: ${{ github.repository_owner }} |
| 66 |
password: ${{ secrets.GITHUB_TOKEN }} |
| 67 |
|
| 68 |
- name: Login to quay.io |
| 69 |
uses: docker/login-action@v4 |
| 70 |
with: |
| 71 |
registry: quay.io |
| 72 |
username: ${{ secrets.QUAY_USERNAME }} |
| 73 |
password: ${{ secrets.QUAY_TOKEN }} |
| 74 |
|
| 75 |
- name: Docker meta |
| 76 |
id: meta |
| 77 |
uses: docker/metadata-action@v6 |
| 78 |
with: |
| 79 |
|
| 80 |
images: | |
| 81 |
oliver006/redis_exporter |
| 82 |
ghcr.io/oliver006/redis_exporter |
| 83 |
quay.io/oliver006/redis_exporter |
| 84 |
|
| 85 |
- name: Build and push scratch image |
| 86 |
uses: docker/build-push-action@v7 |
| 87 |
with: |
| 88 |
context: . |
| 89 |
target: scratch-release |
| 90 |
platforms: linux/amd64,linux/arm,linux/arm64 |
| 91 |
push: true |
| 92 |
sbom: true |
| 93 |
tags: ${{ steps.meta.outputs.tags }} |
| 94 |
labels: ${{ steps.meta.outputs.labels }} |
| 95 |
build-args: | |
| 96 |
TAG=${{ github.ref_name }} |
| 97 |
SHA1=${{ github.sha }} |
| 98 |
|
| 99 |
- name: Build and push alpine image |
| 100 |
uses: docker/build-push-action@v7 |
| 101 |
with: |
| 102 |
context: . |
| 103 |
target: alpine |
| 104 |
platforms: linux/amd64,linux/arm,linux/arm64 |
| 105 |
push: true |
| 106 |
tags: oliver006/redis_exporter:${{ github.ref_name }}-alpine,ghcr.io/oliver006/redis_exporter:${{ github.ref_name }}-alpine,quay.io/oliver006/redis_exporter:${{ github.ref_name }}-alpine,oliver006/redis_exporter:alpine,ghcr.io/oliver006/redis_exporter:alpine,quay.io/oliver006/redis_exporter:alpine |
| 107 |
labels: ${{ steps.meta.outputs.labels }} |
| 108 |
build-args: | |
| 109 |
TAG=${{ github.ref_name }} |
| 110 |
SHA1=${{ github.sha }} |