Skip to content

Commit 828404d

Browse files
committed
A manually triggered action to compile and release the script
1 parent 7f13b56 commit 828404d

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

.github/workflows/compile.yml

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

0 commit comments

Comments
 (0)