Compile and release #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile and release | |
# trigger the workflow manually | |
on: workflow_dispatch | |
jobs: | |
draft_release: | |
name: Create draft release | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_draft_release.outputs.id }} | |
upload_url: ${{ steps.create_draft_release.outputs.upload_url }} | |
steps: | |
- name: Get version from tag | |
id: tag_name | |
run: echo "RELEASE_VERSION=$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV | |
- uses: actions/checkout@v2 | |
- name: Create draft release | |
id: create_draft_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: ${{ env.RELEASE_VERSION }} | |
draft: true | |
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
- name: Upload universalJavaApplicationStub.sh asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_draft_release.outputs.upload_url }} | |
asset_name: universalJavaApplicationStub.sh | |
asset_path: ./src/universalJavaApplicationStub | |
asset_content_type: text/x-shellscript | |
compile: | |
name: Compile the stub | |
needs: draft_release # we need to know the upload URL | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install shc via HomeBrew | |
run: | | |
brew install shc | |
shc -h | |
- name: Compile universalJavaApplicationStub | |
run: | | |
echo "Running shc..." | |
shc -r -f src/universalJavaApplicationStub | |
- name: Build universalJavaApplicationStub x86_64 | |
run: | | |
echo "Running clang for universalJavaApplicationStub.x86_64" | |
clang -o universalJavaApplicationStub.x86_64 -target x86_64-apple-macos10.10 src/universalJavaApplicationStub.x.c | |
strip universalJavaApplicationStub.x86_64 | |
- name: Build universalJavaApplicationStub arm64 | |
run: | | |
echo "Running clang for universalJavaApplicationStub.arm64" | |
clang -o universalJavaApplicationStub.arm64 -target arm64-apple-macos11 src/universalJavaApplicationStub.x.c | |
strip universalJavaApplicationStub.arm64 | |
- name: Build universal universalJavaApplicationStub | |
run: | | |
echo "Runnning lipo" | |
lipo -create -output universalJavaApplicationStub universalJavaApplicationStub.x86_64 universalJavaApplicationStub.arm64 | |
strip universalJavaApplicationStub | |
chmod ug=rwx,o=rx universalJavaApplicationStub | |
- name: Upload universalJavaApplicationStub.x86_64 asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.draft_release.outputs.upload_url }} | |
asset_name: universalJavaApplicationStub.x86_64 | |
asset_path: ./universalJavaApplicationStub.x86_64 | |
asset_content_type: application/octet-stream | |
- name: Upload universalJavaApplicationStub.arm64 asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.draft_release.outputs.upload_url }} | |
asset_name: universalJavaApplicationStub.arm64 | |
asset_path: ./universalJavaApplicationStub.arm64 | |
asset_content_type: application/octet-stream | |
- name: Upload universalJavaApplicationStub asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.draft_release.outputs.upload_url }} | |
asset_name: universalJavaApplicationStub | |
asset_path: ./universalJavaApplicationStub | |
asset_content_type: application/octet-stream | |
publish_release: | |
name: Publish drafted release | |
needs: [ draft_release, compile ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.draft_release.outputs.release_id }} |