-
Notifications
You must be signed in to change notification settings - Fork 48
82 lines (77 loc) · 2.56 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
---
name: Release
# yamllint disable-line rule:truthy
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
os: [linux, darwin]
exclude:
# excludes darwin-arm64 for now
- os: darwin
arch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: setup
run: |
sudo apt update
sudo apt install -y qemu-utils qemu-system-x86
- name: Determine ref
env:
REF: ${{ github.ref }}
run: echo "TAG=$(echo "$REF" | sed -e 's#^.*/##')" >> "$GITHUB_ENV"
- name: Create a GitHub release
id: create-release
uses: actions/github-script@v3
with:
result-encoding: string
script: |
console.log(context)
tag = '${{ env.TAG }}'
// first create a release -- it is OK if that fails,
// since it means the release is already there
try {
const raw = (await github.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
name: 'Release ' + tag,
prerelease: true,
})).data
console.log(raw)
} catch (e) {}
// get the release ID
const release = (await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag,
})).data
return release.upload_url
- name: Build project
run: |
make OS=${{ matrix.os }} ARCH=${{ matrix.arch }} build
make OS=${{ matrix.os }} ARCH=${{ matrix.arch }} build-tests
tar -zcvf eden.${{ matrix.os }}.${{ matrix.arch }}.tar.gz -C ./ ./eden ./README.md dist docs tests
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.result }}
asset_path: ./eden.${{ matrix.os }}.${{ matrix.arch }}.tar.gz
asset_name: eden.${{ matrix.os }}.${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip