Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 87df4af

Browse files
authored
Merge pull request #96 from tofi86/dev/ci-release
GitHub Actions release workflow to publish automated GH releases with compiled binaries fixes #87
2 parents 67623f6 + 60f59a4 commit 87df4af

File tree

3 files changed

+300
-127
lines changed

3 files changed

+300
-127
lines changed

.github/workflows/release.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Release
2+
3+
# Trigger the workflow only on tags
4+
on:
5+
push:
6+
tags:
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
8+
9+
10+
jobs:
11+
12+
draft_release:
13+
name: Create draft release
14+
runs-on: ubuntu-latest
15+
16+
outputs:
17+
release_id: ${{ steps.create_draft_release.outputs.id }}
18+
upload_url: ${{ steps.create_draft_release.outputs.upload_url }}
19+
20+
steps:
21+
- name: Get version from tag
22+
id: tag_name
23+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
24+
25+
- uses: actions/checkout@v2
26+
27+
- name: Get Changelog Entry
28+
id: changelog_reader
29+
uses: mindsers/changelog-reader-action@v2
30+
with:
31+
version: ${{ env.RELEASE_VERSION }}
32+
path: ./CHANGELOG.md
33+
34+
- name: Create draft release
35+
id: create_draft_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}
39+
with:
40+
tag_name: ${{ github.ref }}
41+
release_name: ${{ github.ref }}
42+
draft: true
43+
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
44+
body: ${{ steps.changelog_reader.outputs.changes }}
45+
46+
- name: ZIP uncompiled universalJavaApplicationStub
47+
run: |
48+
echo "Zipping uncompiled script..."
49+
zip --junk-paths universalJavaApplicationStub-uncompiled.zip src/universalJavaApplicationStub
50+
51+
- name: Upload release assets
52+
uses: actions/upload-release-asset@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}
55+
with:
56+
upload_url: ${{ steps.create_draft_release.outputs.upload_url }}
57+
asset_name: universalJavaApplicationStub-v${{ env.RELEASE_VERSION }}-source.zip
58+
asset_path: ./universalJavaApplicationStub-uncompiled.zip
59+
asset_content_type: application/zip
60+
61+
62+
compile:
63+
name: Compile the stub on ${{ matrix.os }}
64+
needs: draft_release # we need to know the upload URL
65+
runs-on: ${{ matrix.os }}
66+
strategy:
67+
matrix:
68+
os: [ macos-10.15 ] # macos-11.0
69+
70+
steps:
71+
- uses: actions/checkout@v2
72+
73+
- name: Set env
74+
run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
75+
76+
- name: Install shc via HomeBrew
77+
run: |
78+
brew install shc
79+
shc -h
80+
81+
- name: Compile universalJavaApplicationStub
82+
run: |
83+
echo "Running shc..."
84+
shc -r -f src/universalJavaApplicationStub
85+
86+
- name: ZIP universalJavaApplicationStub binary
87+
run: |
88+
echo "Zipping binary..."
89+
mv src/universalJavaApplicationStub.x universalJavaApplicationStub
90+
rm src/universalJavaApplicationStub.x.c
91+
zip --junk-paths universalJavaApplicationStub-${{ matrix.os }}.zip universalJavaApplicationStub
92+
93+
- name: Upload release assets
94+
uses: actions/upload-release-asset@v1
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}
97+
with:
98+
upload_url: ${{ needs.draft_release.outputs.upload_url }}
99+
asset_name: universalJavaApplicationStub-${{ env.RELEASE_TAG }}-binary-${{ matrix.os }}.zip
100+
asset_path: ./universalJavaApplicationStub-${{ matrix.os }}.zip
101+
asset_content_type: application/zip
102+
103+
104+
publish_release:
105+
name: Publish drafted release
106+
needs: [ draft_release, compile ]
107+
runs-on: ubuntu-latest
108+
109+
steps:
110+
- uses: eregon/publish-release@v1
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}
113+
with:
114+
release_id: ${{ needs.draft_release.outputs.release_id }}

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Tests and Shellcheck
33
# Trigger the workflow on push or pull request
44
on: [push, pull_request]
55

6-
76

87
jobs:
98

@@ -12,7 +11,7 @@ jobs:
1211
runs-on: ${{ matrix.os }}
1312
strategy:
1413
matrix:
15-
os: [ macos-10.15, macos-11.0 ]
14+
os: [ macos-10.15 ] # macos-11.0
1615

1716
steps:
1817
- uses: actions/checkout@v2
@@ -34,7 +33,7 @@ jobs:
3433
runs-on: ${{ matrix.os }}
3534
strategy:
3635
matrix:
37-
os: [ macos-10.15, macos-11.0 ]
36+
os: [ macos-10.15 ] # macos-11.0
3837

3938
steps:
4039
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)