-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (117 loc) · 4.13 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
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get latest alan version
id: get_latest_alan
run: |
echo "::set-output name=alan_version::$(curl --silent "https://api.github.com/repos/alantech/alan/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')"
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: Release ${{ github.ref }} - Alan version ${{ steps.get_latest_alan.outputs.alan_version }}
draft: false
prerelease: false
ubuntu:
needs: create_release
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Acquire alan
run: |
mkdir tardir
cd tardir
wget https://github.com/alantech/alan/releases/latest/download/alan-ubuntu.tar.gz
tar -xzf alan-ubuntu.tar.gz
sudo mv alan /usr/local/bin/alan
cd ..
rm -rf tardir
- name: Generate Anycloud tar.gz
run: |
cargo build --release
cd ./target/release
tar -czf /tmp/anycloud-ubuntu.tar.gz anycloud
- name: Upload Anycloud tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /tmp/anycloud-ubuntu.tar.gz
asset_name: anycloud-ubuntu.tar.gz
asset_content_type: application/gzip
windows:
needs: create_release
runs-on: windows-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Acquire alan
run: |
mkdir zipdir
cd zipdir
Invoke-WebRequest -OutFile alan-windows.zip -Uri https://github.com/alantech/alan/releases/latest/download/alan-windows.zip
Expand-Archive -Path alan-windows.zip -DestinationPath C:\windows
cd ..
rm -r -Force zipdir
- name: Generate Anycloud zip
run: |
cargo build --release
Compress-Archive -Path "$(Join-Path (Get-Location).Path '\\target\\release\\anycloud.exe')" -DestinationPath "$(Join-Path (Get-Location).Path 'anycloud-windows.zip')"
- name: Upload Anycloud zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./anycloud-windows.zip
asset_name: anycloud-windows.zip
asset_content_type: application/zip
macos:
needs: create_release
runs-on: macos-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Acquire alan
run: |
brew install gnu-tar
mkdir tardir
cd tardir
curl -OL https://github.com/alantech/alan/releases/latest/download/alan-macos.tar.gz
gtar -xzf alan-macos.tar.gz
sudo mkdir -p /usr/local/bin
sudo mv alan /usr/local/bin/alan
cd ..
rm -rf tardir
- name: Generate Anycloud tar.gz
run: |
cargo build --release
cd ./target/release
gtar -czf /tmp/anycloud-macos.tar.gz anycloud
- name: Upload Anycloud tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /tmp/anycloud-macos.tar.gz
asset_name: anycloud-macos.tar.gz
asset_content_type: application/gzip