-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (70 loc) · 2.36 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
# this workflow releases the container images to ghcr.io
# trigger it by pushing a tag of the form v1.2.3
# Note - the push will fail if the CHANGELOG.md does not contain
# an entry for the version being released.
name: Release
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- alpine
# - android-armv7
# - android-arm64
- centos7
# - linux-armv6
# - linux-armv7
# - linux-armv7l-musl
- linux-arm64
# - linux-arm64-lts
# - linux-arm64-musl
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare tags
run: |
echo "MAJOR=$(echo ${GITHUB_REF/refs\/tags\/v/} | awk -F '.' '{print $1}')" >> $GITHUB_ENV
echo "MINOR=$(echo ${GITHUB_REF/refs\/tags\/v/} | awk -F '.' '{print $1"."$2}')" >> $GITHUB_ENV
echo "PATCH=$(echo ${GITHUB_REF/refs\/tags\/v/} | awk -F '.' '{print $1"."$2"."$3}')" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.image }}
tags: |
ghcr.io/contrast-security-oss/${{ matrix.image }}:latest
ghcr.io/contrast-security-oss/${{ matrix.image }}:${{ env.MAJOR }}
ghcr.io/contrast-security-oss/${{ matrix.image }}:${{ env.MINOR }}
ghcr.io/contrast-security-oss/${{ matrix.image }}:${{ env.PATCH }}
labels: |
org.opencontainers.image.version=${{ env.PATCH }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=GPL-3.0-only
push: true
release:
name: Release
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create GitHub release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}