-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (121 loc) · 4.88 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Release
on:
push:
tags:
- "v*"
jobs:
docker:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
arch: ["arm64", "amd64"]
include:
- arch: arm64
os: self-hosted-arm64
- arch: amd64
os: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Tag release
run: |
release=`echo ${{ steps.get_version.outputs.VERSION }} | cut -d'-' -f2`
cat BUILD.bazel | sed s/-jc+master/-jc-$release/ | sed s/100master/${release:1}/ > BUILD.versioned
cat BUILD.versioned
mv BUILD.versioned BUILD.bazel
# - name: Set up QEMU
# run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/${{ matrix.arch }}
push: true
tags: |
jesec/rtorrent:latest-${{ matrix.arch }}
- name: Extract built rTorrent artifacts from Docker image
run: |
docker buildx build --platform linux/${{ matrix.arch }} --target build -o type=tar . > ../out.tar
tar xvf ../out.tar root/rtorrent/dist
- name: Prepare distribution archive
run: |
mkdir dist-${{ matrix.arch }}
cp doc/rtorrent.rc doc/rtorrent@.service root/rtorrent/dist/rtorrent dist-${{ matrix.arch }}
- uses: actions/upload-artifact@v2
with:
name: rtorrent-linux-${{ matrix.arch }}
path: dist-${{ matrix.arch }}/*
- uses: actions/upload-artifact@v2
with:
name: rtorrent-deb-${{ matrix.arch }}
path: root/rtorrent/dist/rtorrent-deb.deb
- uses: actions/upload-artifact@v2
with:
name: rtorrent-rpm-${{ matrix.arch }}
path: root/rtorrent/dist/rtorrent-rpm.rpm
docker-manifest:
needs: docker
runs-on: ubuntu-20.04
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Merge multi-arch Docker image manifests
run: |
docker buildx imagetools create -t jesec/rtorrent:latest jesec/rtorrent:latest-arm64 jesec/rtorrent:latest-amd64
docker buildx imagetools create -t jesec/rtorrent:${{ steps.get_version.outputs.VERSION }} jesec/rtorrent:latest-arm64 jesec/rtorrent:latest-amd64
- name: Remove intermediate tags
run: |
token=`curl -s -H "Content-Type: application/json" -X POST -d '{"username": "jesec","password":"${{ secrets.DOCKERHUB_PASSWORD }}"}' "https://hub.docker.com/v2/users/login/" | jq -r '.token'`
curl "https://hub.docker.com/v2/repositories/jesec/rtorrent/tags/latest-arm64/" -X DELETE -H "Authorization: JWT ${token}"
curl "https://hub.docker.com/v2/repositories/jesec/rtorrent/tags/latest-amd64/" -X DELETE -H "Authorization: JWT ${token}"
create-release:
needs: docker
runs-on: ubuntu-20.04
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/download-artifact@v2
with:
path: artifacts
- run: |
cp artifacts/rtorrent-linux-amd64/* .
cp artifacts/rtorrent-linux-amd64/rtorrent rtorrent-linux-amd64
cp artifacts/rtorrent-linux-arm64/rtorrent rtorrent-linux-arm64
cp artifacts/rtorrent-deb-amd64/rtorrent-deb.deb rtorrent-linux-amd64.deb
cp artifacts/rtorrent-deb-arm64/rtorrent-deb.deb rtorrent-linux-arm64.deb
cp artifacts/rtorrent-rpm-amd64/rtorrent-rpm.rpm rtorrent-linux-amd64.rpm
cp artifacts/rtorrent-rpm-arm64/rtorrent-rpm.rpm rtorrent-linux-arm64.rpm
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ steps.get_version.outputs.VERSION }}
files: |
rtorrent-linux-amd64
rtorrent-linux-amd64.deb
rtorrent-linux-amd64.rpm
rtorrent-linux-arm64
rtorrent-linux-arm64.deb
rtorrent-linux-arm64.rpm
rtorrent.rc
rtorrent@.service