-
Notifications
You must be signed in to change notification settings - Fork 17
76 lines (64 loc) · 2.09 KB
/
draft.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
# The present workflow was made based on the following references:
# - https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
# - https://github.com/commercialhaskell/stack/blob/master/.github/workflows/integration-tests.yml
---
name: Draft
on:
push:
tags:
- v*
concurrency:
group: draft-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ github.repository }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Copy static binary
run: |
docker run \
--entrypoint cp \
--volume $PWD/bin:/root/bin \
${{ github.repository }} \
/usr/local/bin/hap \
/root/bin/hap-${{ github.ref_name }}-linux-x86_64-bin
- name: Change owner before compression
run: sudo chown $USER:$USER bin/hap-${{ github.ref_name }}-linux-x86_64-bin
- name: Compress binary
uses: svenstaro/upx-action@v2
with:
file: bin/hap-${{ github.ref_name }}-linux-x86_64-bin
args: --best --lzma
strip: true
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
files: |
bin/hap-*
LICENSE
draft: true
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache