-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (83 loc) · 2.73 KB
/
v2.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: v2
on:
push:
tags:
- "2.*"
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
BUILD_CTX: v2
BUILD_PLATFORMS: linux/amd64,linux/arm64
DOCKER_VERSION: "24.0.7"
DOCKER_BUILDX_VERSION: "0.11.2"
DOCKER_COMPOSE_VERSION: "2.21.0"
steps:
- name: Setup Envs
run: echo BUILD_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5
# https://github.com/docker/metadata-action
with:
images: |
ghcr.io/cheyilin/docker-awscli
cheyilin/docker-awscli
tags: |
type=raw,value=${{ env.BUILD_CTX }}
type=semver,pattern={{version}}
flavor: |
latest=true
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.BUILD_PLATFORMS }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v6
# https://github.com/docker/build-push-action
with:
context: ${{ env.BUILD_CTX }}
platforms: ${{ env.BUILD_PLATFORMS }}
build-args: |
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
DOCKER_BUILDX_VERSION=${{ env.DOCKER_BUILDX_VERSION }}
DOCKER_COMPOSE_VERSION=${{ env.DOCKER_COMPOSE_VERSION }}
AWS_CLI_VERSION=${{ env.BUILD_TAG }}
push: true
cache-from: type=registry,ref=ghcr.io/cheyilin/docker-awscli:${{ env.BUILD_CTX }}
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ steps.meta.outputs.tags }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
## GitHub Container Registry
https://ghcr.io/cheyilin/docker-awscli
```text
ghcr.io/cheyilin/docker-awscli:${{ env.BUILD_TAG }}
```
## Docker Hub
https://hub.docker.com/r/cheyilin/docker-awscli
```text
cheyilin/docker-awscli:${{ env.BUILD_TAG }}
```