-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (107 loc) · 3.85 KB
/
create-release.yaml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: release
on:
push:
tags:
- "*"
jobs:
start_release:
name: build_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create release
uses: ncipollo/release-action@v1
id: create_release
with:
draft: true
prerelease: false
name: ${{ github.ref_name }}
tag: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}
build_upload_artifacts:
needs: [ start_release ]
name: build_upload_artifacts
runs-on: ubuntu-latest
strategy:
matrix:
project: [ myceli, controller, hyphae, watcher ]
target:
[
armv7-unknown-linux-gnueabihf,
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: clean cargo
run: cargo clean
- name: cargo/cross build
run: CROSS_CONFIG=Cross.toml cross build --bin ${{ matrix.project }} --target ${{ matrix.target }} --release --features big
- name: Archive binary
run: tar -czvf ${{ matrix.project }}-${{ matrix.target }}.tar.gz -C ./target/${{ matrix.target }}/release ${{ matrix.project }}
- name: upload binary
run: |
echo "GITHUB_REF=${GITHUB_REF}"
mv "$SOURCE_PATH" "$TARGET_PATH"
set -x
gh release upload "$GITHUB_REF" "$TARGET_PATH"
env:
GITHUB_TOKEN: ${{ github.token }}
SOURCE_PATH: ./${{ matrix.project }}-${{ matrix.target }}.tar.gz
TARGET_PATH: ./${{ matrix.project }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
shell: bash
small:
needs: [ start_release ]
name: small
runs-on: ubuntu-latest
strategy:
matrix:
project: [ myceli, watcher ]
target:
[
armv7-unknown-linux-gnueabihf,
aarch64-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: clean cargo
run: cargo clean
- name: cargo/cross build
run: CROSS_CONFIG=Cross.toml cross build --bin ${{ matrix.project }} --target ${{ matrix.target }} --profile small --features small --no-default-features
- name: Compress binary
run: |
tar -cvf ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar -C ./target/${{ matrix.target }}/small ${{ matrix.project }}
xz -9 --keep --extreme ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar
gzip --best ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar
- name: upload binary
run: |
echo "GITHUB_REF=${GITHUB_REF}"
set -x
gh release upload "${GITHUB_REF}" *-small-${{ github.ref_name }}-${{ matrix.target }}.tar.?z
env:
GITHUB_TOKEN: ${{ github.token }}
shell: bash
build_upload_docker:
needs: [ start_release ]
name: build_upload_docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish myceli docker
run: |
docker build -f myceli.Dockerfile . --tag ghcr.io/ipfs-shipyard/myceli:latest --tag ghcr.io/ipfs-shipyard/myceli:${{ github.ref_name }}
docker push ghcr.io/ipfs-shipyard/myceli:latest
docker push ghcr.io/ipfs-shipyard/myceli:${{ github.ref_name }}