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

Commit 2217cd7

Browse files
committed
add a tag based GitHub Actions CI release workflow // refs #87
1 parent 2d2a7d3 commit 2217cd7

File tree

2 files changed

+99
-1
lines changed

2 files changed

+99
-1
lines changed

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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.GITHUB_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+
47+
compile:
48+
name: Compile the stub on ${{ matrix.os }}
49+
needs: draft_release # we need to know the upload URL
50+
runs-on: ${{ matrix.os }}
51+
strategy:
52+
matrix:
53+
os: [ macos-10.15, macos-11.0 ]
54+
55+
steps:
56+
- uses: actions/checkout@v2
57+
58+
- name: Set env
59+
run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
60+
61+
- name: Install shc via HomeBrew
62+
run: |
63+
brew install shc
64+
shc -h
65+
66+
- name: Compile universalJavaApplicationStub
67+
run: |
68+
echo "Running shc..."
69+
shc -r -f src/universalJavaApplicationStub
70+
71+
- name: ZIP universalJavaApplicationStub binary
72+
run: |
73+
echo "Zipping binary..."
74+
mv src/universalJavaApplicationStub.x universalJavaApplicationStub
75+
rm src/universalJavaApplicationStub.x.c
76+
zip --junk-paths universalJavaApplicationStub-${{ matrix.os }}.zip universalJavaApplicationStub
77+
78+
- name: Upload release assets
79+
uses: actions/upload-release-asset@v1
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
with:
83+
upload_url: ${{ needs.draft_release.outputs.upload_url }}
84+
asset_name: universalJavaApplicationStub-${{ env.RELEASE_TAG }}-${{ matrix.os }}.zip
85+
asset_path: ./universalJavaApplicationStub-${{ matrix.os }}.zip
86+
asset_content_type: application/zip
87+
88+
89+
publish_release:
90+
name: Publish drafted release
91+
needs: [ draft_release, compile ]
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- uses: eregon/publish-release@v1
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
with:
99+
release_id: ${{ needs.draft_release.outputs.release_id }}

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
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

0 commit comments

Comments
 (0)