-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (54 loc) · 2.72 KB
/
build.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
name: Build
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
env:
REGISTRY_HOST: ghcr.io
steps:
- uses: actions/checkout@v2
- shell: bash
run: |
echo "##[set-output name=name;]$(echo ${GITHUB_REPOSITORY#*/})"
echo "##[set-output name=ver;]$(echo ${GITHUB_REF#refs/*/})"
echo "##[set-output name=minor_ver;]$(TMP_VAR=${GITHUB_REF#refs/*/}; echo ${TMP_VAR%.*})"
echo "##[set-output name=major_ver;]$(TMP_VAR=${GITHUB_REF#refs/*/}; echo ${TMP_VAR%.*.*})"
echo "##[set-output name=sha;]$(git rev-parse --short "$GITHUB_SHA")"
id: extract_name_and_version
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_HOST }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: sed -i 's/0.1.0/'"${{ steps.extract_name_and_version.outputs.ver }}"'/' pyproject.toml
- run: sed -i 's/0.1.0/'"${{ steps.extract_name_and_version.outputs.ver }}"'/' makeqr/version.py
- uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
"${{ env.REGISTRY_HOST }}/${{ github.repository }}:latest"
"${{ env.REGISTRY_HOST }}/${{ github.repository }}:${{ steps.extract_name_and_version.outputs.sha }}"
"${{ env.REGISTRY_HOST }}/${{ github.repository }}:${{ steps.extract_name_and_version.outputs.major_ver }}"
"${{ env.REGISTRY_HOST }}/${{ github.repository }}:${{ steps.extract_name_and_version.outputs.minor_ver }}"
"${{ env.REGISTRY_HOST }}/${{ github.repository }}:${{ steps.extract_name_and_version.outputs.ver }}"
"${{ github.repository }}:latest"
"${{ github.repository }}:${{ steps.extract_name_and_version.outputs.sha }}"
"${{ github.repository }}:${{ steps.extract_name_and_version.outputs.major_ver }}"
"${{ github.repository }}:${{ steps.extract_name_and_version.outputs.minor_ver }}"
"${{ github.repository }}:${{ steps.extract_name_and_version.outputs.ver }}"
labels:
"org.opencontainers.image.source=https://github.com/${{ github.repository }}"
build-args: |
SHORTENER_VERSION=${{ steps.extract_name_and_version.outputs.ver }}
cache-from: type=registry,ref=${{ env.REGISTRY_HOST }}/${{ github.repository }}:${{ steps.extract_name_and_version.outputs.minor_ver }}
cache-to: type=inline