-
Notifications
You must be signed in to change notification settings - Fork 7
49 lines (40 loc) · 1.29 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
name: Build & Release
on:
release:
types: [ published ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
coverage: none
- name: Install Dependencies
run: |
composer install --no-dev --prefer-dist
- name: Set Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build Binary
run: php harbor app:build --build-version=${{ env.RELEASE_VERSION }}
- name: Automatic Release
uses: actions/github-script@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fs = require("fs").promises;
const { repo: { owner, repo }, sha } = context;
const release = await github.repos.getReleaseByTag({
owner, repo,
tag: process.env.GITHUB_REF.replace("refs/tags/", ""),
});
await github.repos.uploadReleaseAsset({
owner, repo,
name: "harbor",
data: await fs.readFile("./builds/harbor"),
release_id: release.data.id,
});