-
Notifications
You must be signed in to change notification settings - Fork 5
78 lines (70 loc) · 1.97 KB
/
ci.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
name: CI
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
- ci/*
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
jobs:
build:
runs-on: ${{ matrix.os }}
outputs:
release_id: ${{ steps.release.outputs.id }}
strategy:
matrix:
build: [linux]
include:
- build: linux
os: ubuntu-latest
target: x86_64
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get the build metadata
shell: bash
run: |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(grep -m 1 '^export PACKAGE_VERSION=' build.sh | cut -f 2 -d '=')" >> $GITHUB_ENV
# - name: Validate git tag and package version
# shell: bash
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# if [ "${{ env.VERSION }}" != "${{ env.PACKAGE_VERSION }}" ]; then
# echo "git tag version (${{ env.VERSION }}) does not match build.sh version (v${{ env.PACKAGE_VERSION }})"
# exit 1
# fi
- name: Build .spk package
run: |
./build.sh
echo "ASSET=$(ls *.spk)" >> $GITHUB_ENV
- name: Create draft release and upload asset
id: release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: ${{ env.ASSET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-release:
name: publish-release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: ['build']
steps:
- name: Publish release
uses: StuYarrow/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ needs.build.outputs.release_id }}