-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (66 loc) · 2.1 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
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-devtoolset7
- linux-armv6
- linux-armv7
- linux-armv7l-musl
- linux-arm64
- linux-arm64-lts
- linux-arm64-musl
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login
uses: docker/login-action@v2
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@v3
with:
context: ${{ matrix.image }}
tags: |
ghcr.io/prebuild/${{ matrix.image }}:latest
ghcr.io/prebuild/${{ matrix.image }}:${{ env.MAJOR }}
ghcr.io/prebuild/${{ matrix.image }}:${{ env.MINOR }}
ghcr.io/prebuild/${{ 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@v3
- name: Create GitHub release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}