Skip to content

Commit d2cf5df

Browse files
authored
Update buildService.yml
Add missing files
1 parent 971024b commit d2cf5df

File tree

1 file changed

+50
-15
lines changed

1 file changed

+50
-15
lines changed

.github/workflows/buildService.yml

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
name: Build Service
1+
name: Release Service
22

33
on:
4-
workflow_dispatch:
5-
pull_request:
6-
paths-ignore: ['*.md']
7-
branches: ['main', 'master']
84
push:
9-
paths-ignore: ['*.md']
10-
branches: ['main', 'master']
5+
tags:
6+
- 'v*.*'
117

128
jobs:
13-
BuildPackage:
9+
ReleasePackage:
1410
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1513
steps:
1614
- name: Prepare StartOS SDK
1715
uses: Start9Labs/sdk@v1
@@ -20,18 +18,55 @@ jobs:
2018
uses: actions/checkout@v4
2119

2220
- name: Build the service package
23-
id: build
2421
run: |
2522
git submodule update --init --recursive
2623
start-sdk init
2724
make
28-
PACKAGE_ID=$(yq -oy ".id" manifest.*)
29-
echo "package_id=$PACKAGE_ID" >> $GITHUB_ENV
25+
26+
- name: Setting package ID and title from the manifest
27+
id: package
28+
run: |
29+
echo "package_id=$(yq -oy ".id" manifest.*)" >> $GITHUB_ENV
30+
echo "package_title=$(yq -oy ".title" manifest.*)" >> $GITHUB_ENV
31+
shell: bash
32+
33+
- name: Generate sha256 checksum
34+
run: |
35+
PACKAGE_ID=${{ env.package_id }}
3036
printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n"
37+
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
3138
shell: bash
3239

33-
- name: Upload .s9pk
34-
uses: actions/upload-artifact@v4
40+
- name: Generate changelog
41+
run: |
42+
PACKAGE_ID=${{ env.package_id }}
43+
echo "## What's Changed" > change-log.txt
44+
yq -oy '.release-notes' manifest.* >> change-log.txt
45+
echo "## SHA256 Hash" >> change-log.txt
46+
echo '```' >> change-log.txt
47+
sha256sum ${PACKAGE_ID}.s9pk >> change-log.txt
48+
echo '```' >> change-log.txt
49+
shell: bash
50+
51+
- name: Create GitHub Release
52+
uses: softprops/action-gh-release@v2
3553
with:
36-
name: ${{ env.package_id }}.s9pk
37-
path: ./${{ env.package_id }}.s9pk
54+
tag_name: ${{ github.ref_name }}
55+
name: ${{ env.package_title }} ${{ github.ref_name }}
56+
prerelease: true
57+
body_path: change-log.txt
58+
files: |
59+
./${{ env.package_id }}.s9pk
60+
./${{ env.package_id }}.s9pk.sha256
61+
62+
- name: Publish to Registry
63+
env:
64+
S9USER: ${{ secrets.S9USER }}
65+
S9PASS: ${{ secrets.S9PASS }}
66+
S9REGISTRY: ${{ secrets.S9REGISTRY }}
67+
run: |
68+
if [[ -z "$S9USER" || -z "$S9PASS" || -z "$S9REGISTRY" ]]; then
69+
echo "Publish skipped: missing registry credentials."
70+
else
71+
start-sdk publish https://$S9USER:$S9PASS@$S9REGISTRY ${{ env.package_id }}.s9pk
72+
fi

0 commit comments

Comments
 (0)