-
Notifications
You must be signed in to change notification settings - Fork 7
62 lines (57 loc) · 2.01 KB
/
build-and-trigger-deploy.yml
File metadata and controls
62 lines (57 loc) · 2.01 KB
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
name: Build and Trigger Deploy
on:
push:
branches:
- master
tags:
- 'v*'
env:
IMAGEID: rapidlua/luajit.me
jobs:
version-stamp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Version stamp
run: git describe --tags '--match=v*' | sed -e s/^v// > version
- uses: actions/upload-artifact@v1.0.0
with: { name: version, path: version }
docker-image-amd64:
runs-on: ubuntu-latest
needs: version-stamp
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@v1.0.0
with: { name: version }
- name: Build Docker image
run: >
VERSION=$(cat version/version);
DOCKER_BUILDKIT=1 docker build . --tag "${IMAGEID}:${VERSION}-amd64" --build-arg "VERSION=${VERSION}" &&
docker save "${IMAGEID}:${VERSION}-amd64" | gzip > image.tar.gz
- uses: actions/upload-artifact@v1.0.0
with: { name: docker-image-amd64, path: image.tar.gz }
postprocess-and-trigger-deploy:
runs-on: ubuntu-latest
needs: [version-stamp, docker-image-amd64]
steps:
- uses: actions/download-artifact@v1.0.0
with: { name: version }
- uses: actions/download-artifact@v1.0.0
with: { name: docker-image-amd64 }
- name: Configure Docker client / login
run: >
mkdir -p ~/.docker &&
echo '{"experimental":"enabled"}' > ~/.docker/config.json &&
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u mejedi --password-stdin
- name: Upload Docker images
run: >
VERSION=$(cat version/version);
IID=${IMAGEID}:${VERSION};
zcat docker-image-amd64/image.tar.gz | docker image load &&
docker push "${IID}-amd64" &&
docker manifest create "${IID}" "${IID}-amd64" &&
docker manifest push "${IID}" &&
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
docker manifest create "${IMAGEID}:latest" "${IID}-amd64" &&
docker manifest push "${IMAGEID}:latest"
fi