-
Notifications
You must be signed in to change notification settings - Fork 15
161 lines (146 loc) · 5.14 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Release
on:
workflow_dispatch:
inputs:
level:
type: choice
description: "Release level"
required: true
options:
- "patch"
- "minor"
- "major"
default: "patch"
jobs:
prerelease:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set Git Config
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Rust Cache
uses: Swatinem/[email protected]
with:
cache-targets: "false"
- name: Cargo install cargo-release
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-release
- name: Perform Cargo release
uses: actions-rs/cargo@v1
with:
command: release
args: ${{ github.event.inputs.level }} --execute --no-confirm
- name: Version
id: vars
shell: bash
run: |
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
echo ::set-output name=VERSION::$(echo "$version")
build:
needs: [ prerelease ]
name: 'Build ${{ matrix.job.target }}'
strategy:
fail-fast: true
matrix:
job:
- { target: aarch64-apple-darwin , os: macos-latest , jreleaser_platform: osx-aarch_64 }
- { target: x86_64-apple-darwin , os: macos-latest , jreleaser_platform: osx-x86_64 }
- { target: x86_64-pc-windows-msvc , os: windows-latest, jreleaser_platform: windows-x86_64 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 , jreleaser_platform: linux-x86_64 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04 , use-cross: true, jreleaser_platform: linux-aarch_64 }
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.target }}
override: true
profile: minimal
- uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --locked --release --target=${{ matrix.job.target }}
- name: Assemble
uses: jreleaser/release-action@v2
with:
version: latest
arguments: assemble
env:
JRELEASER_PROJECT_VERSION: ${{ needs.prerelease.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PLATFORM_OVERRIDE: ${{ matrix.job.jreleaser_platform }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: artifacts
path: |
out/jreleaser/assemble/sdkman-cli-native/archive/*.zip
- name: JReleaser output
if: always()
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: jreleaser-${{ matrix.job.target }}
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
release:
needs: [ prerelease, build ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Release
uses: jreleaser/release-action@v2
with:
version: latest
arguments: release -PartifactsDir=artifacts -PskipArchiveResolver
env:
JRELEASER_PROJECT_VERSION: ${{ needs.prerelease.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_SKIP_TAG: true
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN}}
- name: JReleaser output
if: always()
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
- name: Update MongoDB
env:
MONGO_URL: ${{ secrets.MONGO_URL }}
MONGO_USERNAME: ${{ secrets.MONGO_USERNAME }}
MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }}
CARGO_RELEASE_TAG: ${{ needs.prerelease.outputs.VERSION }}
run: bin/release-binary.sh "$MONGO_URL" "$MONGO_USERNAME" "$MONGO_PASSWORD" "$CARGO_RELEASE_TAG"