-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (48 loc) · 1.83 KB
/
create_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
name: create_release
on:
release:
types: [published]
env:
SECRETS_ARE_AVAILABLE: ${{ secrets.DOCKERHUB_USERNAME }}
BUILD_REPOSITORY: knicknic/webtoons-comments
BUILD_PLATFORMS: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6 # all platforms from available platforms that are also available from debian:latest
jobs:
build_all_arch:
runs-on: ubuntu-latest
steps:
-
uses: actions/[email protected]
-
name: Set up QEMU
uses: docker/[email protected]
-
name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
with:
install: true
# above aliases `docker buildx build` as `docker build`
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
-
name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Get short tag name
#converts v1.0.0 -> v1
id: shortTagName
shell: pwsh
env:
SEMANTIC_VERSION: ${{ github.event.release.tag_name }}
run: |
$shortVersion = $env:SEMANTIC_VERSION.split(".")[0]
echo "::set-output name=tag::$shortVersion"
-
name: Build & push image & push cache
# all platforms from available platforms that are also available from debian:latest
run: |
docker build . -t ${{ env.BUILD_REPOSITORY }}:latest -t ${{ env.BUILD_REPOSITORY }}:${{ steps.shortTagName.outputs.tag }} -t ${{ env.BUILD_REPOSITORY }}:${{ github.event.release.tag_name }} --platform ${{ env.BUILD_PLATFORMS }} --cache-from type=registry,ref=${{ env.BUILD_REPOSITORY }}:build --cache-to type=registry,ref=${{ env.BUILD_REPOSITORY }}:build,node=max,push=true --push