-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (57 loc) · 2.11 KB
/
docker-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
57
58
59
60
61
62
63
64
65
66
67
name: Docker Build
on:
push:
branches: [ buildfile, verifier ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest # , self-hosted
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image (manual)
run: |
docker build --no-cache -t e36io/hyperfridge-r0:${{ github.run_id }} .
- name: Create and Run Temporary Container
run: |
docker create --name temp-container e36io/hyperfridge-r0:${{ github.run_id }}
docker cp temp-container:/host/out/IMAGE_ID.hex ./IMAGE_ID.hex
docker cp temp-container:/app ./app
docker cp temp-container:/data ./data
docker rm temp-container
- name: Zip App and Data Directories to create a release
run: |
zip -r hyperfridge-${{ github.run_id }}.zip ./app ./data
- name: Read the Image Tag
id: read_tag
run: echo "IMAGE_TAG=$(cat IMAGE_ID.hex)" >> $GITHUB_ENV
- name: Build and Push Docker image with custom tag
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: e36io/hyperfridge-r0:${{ env.IMAGE_TAG }}
- name: Create GitHub Tag
if: github.event_name != 'pull_request'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag ${{ env.IMAGE_TAG }}
git push origin ${{ env.IMAGE_TAG }}
- name: Create GitHub Release
if: github.event_name != 'pull_request'
run: |
gh release create ${{ env.IMAGE_TAG }} hyperfridge-${{ github.run_id }}.zip --title "Release ${{ env.IMAGE_TAG }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}