-
Notifications
You must be signed in to change notification settings - Fork 12
79 lines (67 loc) · 2.35 KB
/
release.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
name: Release
on:
push:
tags:
- '*'
jobs:
github:
name: 'GitHub Release'
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout sources
uses: actions/checkout@v2
- name: Install dependent packages
run: sudo apt install -y musl-tools
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=x86_64-unknown-linux-musl
- id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: v${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: target/x86_64-unknown-linux-musl/release/kurobako
asset_name: kurobako-${{ steps.get_version.outputs.VERSION }}.linux-amd64
asset_content_type: application/octet-stream
docker:
name: 'Docker Hub Release'
needs: [github]
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout sources
uses: actions/checkout@v2
- name: Build docker image
run: |
docker build --build-arg KUROBAKO_VERSION=${{ steps.get_version.outputs.VERSION }} -t sile/kurobako:latest docker/
docker tag sile/kurobako:latest sile/kurobako:${{ steps.get_version.outputs.VERSION }}
- name: Push to Docker Hub
env:
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
run: |
echo "${DOCKER_HUB_TOKEN}" | docker login -u sile --password-stdin
docker push sile/kurobako:latest
docker push sile/kurobako:${{ steps.get_version.outputs.VERSION }}