-
Notifications
You must be signed in to change notification settings - Fork 361
134 lines (118 loc) · 4.17 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
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
paths-ignore:
- '.github'
name: Release
permissions:
contents: write
jobs:
note:
name: Pre note
runs-on: ubuntu-20.04
timeout-minutes: 5
outputs:
stringver: ${{ steps.contentrel.outputs.stringver }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
path: src/github.com/sealerio/sealer
- name: stringver
id: contentrel
run: |
RELEASEVER=${{ github.ref }}
echo "stringver=${RELEASEVER#refs/tags/v}" >> $GITHUB_STATE
working-directory: src/github.com/sealerio/sealer
- uses: release-drafter/release-drafter@v5
name: create release drafter
id: drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: write release draft to file
shell: bash
working-directory: src/github.com/sealerio/sealer
run: |
echo "${{steps.drafter.outputs.body}}" >> release_note.md
- name: Save release notes
uses: actions/upload-artifact@v2
with:
name: sealer-release-notes
path: src/github.com/sealerio/sealer/release_note.md
build:
name: Build Release Binaries
runs-on: ${{ matrix.os }}
needs: [ note ]
timeout-minutes: 10
strategy:
matrix:
os: [ ubuntu-20.04 ]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v3
with:
go-version: '1.17'
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
- name: Set env
shell: bash
env:
MOS: ${{ matrix.os }}
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
os=linux
echo "GIT_TAG=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "OS=${os}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout sealer
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
path: src/github.com/sealerio/sealer
- name: Make linux
shell: bash
run: |
export MULTI_PLATFORM_BUILD=true
make linux
working-directory: src/github.com/sealerio/sealer
- name: Save build binaries
uses: actions/upload-artifact@v2
with:
name: sealer-binaries
path: src/github.com/sealerio/sealer/_output/assets/*.tar.gz*
release:
name: Create sealer Release
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [ build, note ]
steps:
- name: Download builds and release notes
uses: actions/download-artifact@v2
with:
path: builds
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: true
name: sealer ${{ needs.note.outputs.stringver }}
draft: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
body_path: ./builds/sealer-release-notes/release_note.md
files: |
builds/sealer-binaries/*
- name: Build binareies to oss
if: ${{ github.repository == 'sealerio/sealer' && github.ref_type=='tag' }}
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
wget http://gosspublic.alicdn.com/ossutil/1.6.19/ossutil64 && chmod 755 ossutil64 &&
./ossutil64 -i ${{ secrets.ACCESSKEYID }} -k ${{ secrets.ACCESSKEYSECRET }} -e oss-cn-shanghai.aliyuncs.com cp -rf ./builds/sealer-binaries/sealer-$releasever-linux-amd64.tar.gz oss://sealerio/releases/sealer-$releasever-linux-amd64.tar.gz &&
./ossutil64 -i ${{ secrets.ACCESSKEYID }} -k ${{ secrets.ACCESSKEYSECRET }} -e oss-cn-shanghai.aliyuncs.com cp -rf ./builds/sealer-binaries/sealer-$releasever-linux-arm64.tar.gz oss://sealerio/releases/sealer-$releasever-linux-arm64.tar.gz