-
Notifications
You must be signed in to change notification settings - Fork 5
136 lines (120 loc) · 3.93 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
name: release
on:
workflow_dispatch:
inputs:
tag:
description: 'Which tag to deploy as:'
required: true
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
build-release:
name: build
runs-on: ${{ matrix.targets.os }}
container: ${{ matrix.targets.container }}
env:
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
targets:
- os: 'ubuntu-20.04'
target: 'x86_64-unknown-linux-gnu'
cross: false
- os: 'macos-13'
target: 'x86_64-apple-darwin'
cross: false
- os: 'windows-2019'
target: 'x86_64-pc-windows-gnu'
cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.targets.target }}
- name: Install linux packages
if: matrix.targets.os == 'ubuntu-20.04'
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y libdbus-1-dev
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.targets.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --target=${{ matrix.targets.target }}
use-cross: ${{ matrix.targets.cross }}
- name: Bundle release (Windows)
if: matrix.targets.os == 'windows-2019'
shell: bash
run: |
cp target/${{ matrix.targets.target }}/release/saml2aws-auto.exe saml2aws-auto.exe
7z a saml2aws-auto-${{ matrix.targets.target }}.zip "saml2aws-auto.exe"
echo "ASSET=saml2aws-auto-${{ matrix.targets.target }}.zip" >> $GITHUB_ENV
- name: Bundle release (Linux and macOS)
if: matrix.targets.os != 'windows-2019'
shell: bash
run: |
cp target/${{ matrix.targets.target }}/release/saml2aws-auto ./saml2aws-auto
zip saml2aws-auto-${{ matrix.targets.target }}${{ matrix.targets.suffix }}.zip saml2aws-auto
echo "ASSET=saml2aws-auto-${{ matrix.targets.target }}${{ matrix.targets.suffix }}.zip" >> $GITHUB_ENV
- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv ${{ env.ASSET }} release/
- name: Save release as artifact
uses: actions/upload-artifact@v2
with:
retention-days: 3
name: release
path: release
upload-release:
name: upload-release
runs-on: ubuntu-latest
needs: [build-release]
steps:
- name: Get the release version from the tag
if: env.VERSION == ''
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
echo "Manual run against a tag; overriding actual tag in the environment..."
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
- name: Validate release version
run: |
echo "Release version: ${{ env.VERSION }}"
- name: Get release artifacts
uses: actions/download-artifact@v2
with:
name: release
path: release
- name: Print out all release files
run: |
echo "Generated $(ls ./release | wc -l) files:"
ls ./release
- name: Upload all saved release files
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
tag_name: ${{ env.VERSION }}
draft: true
fail_on_unmatched_files: true
name: ${{ env.VERSION }} Release
body: |
<!-- Write summary here -->
files: |
./release/*