Skip to content

Commit 7723259

Browse files
Merge pull request #66 from manojkarthick/ci/release
Add ARM64 builds and adopt JReleaser for releases
2 parents e16fe34 + fc6c80a commit 7723259

File tree

2 files changed

+163
-25
lines changed

2 files changed

+163
-25
lines changed

.github/workflows/rust.yml

Lines changed: 98 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,51 @@ jobs:
2222
with:
2323
command: check
2424

25+
precheck:
26+
if: startsWith(github.ref, 'refs/tags/')
27+
runs-on: ubuntu-latest
28+
outputs:
29+
VERSION: ${{ steps.vars.outputs.VERSION }}
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v1
33+
34+
- name: Version
35+
id: vars
36+
shell: bash
37+
run: |
38+
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
39+
echo ::set-output name=VERSION::$(echo "$version")
40+
2541
publish:
42+
needs: [ precheck ]
2643
if: startsWith(github.ref, 'refs/tags/')
27-
name: Publish for ${{ matrix.os }}
44+
name: Build ${{ matrix.target }}
2845
runs-on: ${{ matrix.os }}
2946
strategy:
47+
fail-fast: true
3048
matrix:
31-
name: [
32-
linux,
33-
windows,
34-
macos
35-
]
36-
3749
include:
38-
- name: linux
50+
- target: x86_64-unknown-linux-gnu
3951
os: ubuntu-latest
40-
artifact_name: target/release/reddsaver
41-
asset_name: reddsaver-linux-amd64
42-
- name: windows
43-
os: windows-latest
44-
artifact_name: target/release/reddsaver.exe
45-
asset_name: reddsaver-windows-amd64
46-
- name: macos
52+
use-cross: false
53+
jreleaser_platform: linux-x86_64
54+
- target: aarch64-unknown-linux-gnu
55+
os: ubuntu-latest
56+
use-cross: true
57+
jreleaser_platform: linux-aarch_64
58+
- target: x86_64-apple-darwin
4759
os: macos-latest
48-
artifact_name: target/release/reddsaver
49-
asset_name: reddsaver-macos-amd64
60+
use-cross: false
61+
jreleaser_platform: osx-x86_64
62+
- target: aarch64-apple-darwin
63+
os: macos-latest
64+
use-cross: false
65+
jreleaser_platform: osx-aarch_64
66+
- target: x86_64-pc-windows-msvc
67+
os: windows-latest
68+
use-cross: false
69+
jreleaser_platform: windows-x86_64
5070

5171
steps:
5272
- name: Checkout repository
@@ -57,15 +77,68 @@ jobs:
5777
with:
5878
profile: minimal
5979
toolchain: stable
80+
target: ${{ matrix.target }}
81+
override: true
6082

6183
- name: Build
62-
run: cargo build --release --locked
84+
uses: actions-rs/cargo@v1
85+
with:
86+
use-cross: ${{ matrix.use-cross }}
87+
command: build
88+
args: --locked --release --target=${{ matrix.target }}
89+
90+
- name: Assemble
91+
uses: jreleaser/release-action@v2
92+
with:
93+
version: early-access
94+
arguments: assemble
95+
env:
96+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
97+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
JRELEASER_PLATFORM_OVERRIDE: ${{ matrix.jreleaser_platform }}
99+
100+
- name: Upload artifacts
101+
uses: actions/upload-artifact@v3
102+
with:
103+
retention-days: 1
104+
name: artifacts
105+
path: |
106+
out/jreleaser/assemble/reddsaver/archive/*.zip
107+
108+
- name: JReleaser output
109+
if: always()
110+
uses: actions/upload-artifact@v3
111+
with:
112+
name: jreleaser-output-${{ matrix.target }}
113+
path: |
114+
out/jreleaser/trace.log
115+
out/jreleaser/output.properties
116+
117+
release:
118+
needs: [ precheck, publish ]
119+
runs-on: ubuntu-latest
120+
121+
steps:
122+
- name: Checkout
123+
uses: actions/checkout@v1
124+
125+
- name: Download artifacts
126+
uses: actions/download-artifact@v3
127+
128+
- name: Release
129+
uses: jreleaser/release-action@v2
130+
with:
131+
version: early-access
132+
arguments: full-release -PartifactsDir=artifacts -PskipArchiveResolver
133+
env:
134+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
135+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63136

64-
- name: Upload binaries to release
65-
uses: svenstaro/upload-release-action@v2
137+
- name: JReleaser output
138+
if: always()
139+
uses: actions/upload-artifact@v3
66140
with:
67-
repo_token: ${{ secrets.GITHUB_TOKEN }}
68-
file: ${{ matrix.artifact_name }}
69-
asset_name: ${{ matrix.asset_name }}
70-
tag: ${{ github.ref }}
71-
overwrite: true
141+
name: output-release-logs
142+
path: |
143+
out/jreleaser/trace.log
144+
out/jreleaser/output.properties

jreleaser.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
environment:
2+
properties:
3+
artifactsDir: out/jreleaser/assemble/reddsaver/archive
4+
5+
project:
6+
name: reddsaver
7+
description: CLI tool to download saved media from Reddit
8+
longDescription: CLI tool to download saved and upvoted media from Reddit
9+
website: https://github.com/manojkarthick/reddsaver
10+
authors:
11+
- Manoj Karthick
12+
license: MIT
13+
extraProperties:
14+
inceptionYear: 2020
15+
16+
platform:
17+
replacements:
18+
'osx-x86_64': 'x86_64-apple-darwin'
19+
'osx-aarch_64': 'aarch64-apple-darwin'
20+
'linux-x86_64': 'x86_64-unknown-linux-gnu'
21+
'linux-aarch_64': 'aarch64-unknown-linux-gnu'
22+
'windows-x86_64': 'x86_64-pc-windows-msvc'
23+
24+
release:
25+
github:
26+
name: reddsaver
27+
overwrite: true
28+
branch: master
29+
changelog:
30+
formatted: ALWAYS
31+
format: '- {{commitShortHash}} {{commitTitle}}'
32+
preset: conventional-commits
33+
contributors:
34+
enabled: false
35+
36+
assemble:
37+
archive:
38+
reddsaver:
39+
active: ALWAYS
40+
formats:
41+
- ZIP
42+
attachPlatform: true
43+
fileSets:
44+
- input: 'target/{{ osPlatformReplaced }}/release'
45+
output: 'bin'
46+
includes: [ 'reddsaver{.exe,}' ]
47+
- input: '.'
48+
includes: [ 'LICENSE-MIT', 'LICENSE-APACHE' ]
49+
50+
distributions:
51+
reddsaver:
52+
type: BINARY
53+
executable:
54+
windowsExtension: exe
55+
artifacts:
56+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-x86_64-apple-darwin.zip'
57+
platform: 'osx-x86_64'
58+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-aarch64-apple-darwin.zip'
59+
platform: 'osx-aarch_64'
60+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-x86_64-unknown-linux-gnu.zip'
61+
platform: 'linux-x86_64'
62+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-aarch64-unknown-linux-gnu.zip'
63+
platform: 'linux-aarch_64'
64+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-x86_64-pc-windows-msvc.zip'
65+
platform: 'windows-x86_64'

0 commit comments

Comments
 (0)