Create release and upload binaries on tagging. #8
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: Create Release and Upload Binaries on Tag. | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Install Leiningen | |
run: | | |
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein | |
chmod +x lein | |
sudo mv lein /usr/local/bin/ | |
- name: Generate binaries | |
run: | | |
lein bin | |
lein uberjar | |
- name: Extract version from tag | |
id: extract_version | |
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ steps.extract_version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload uberjar | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/uberjar/jmx-dump-${{ steps.extract_version.outputs.version }}-standalone.jar | |
asset_name: jmx-dump-${{ steps.extract_version.outputs.version }}-standalone.jar | |
asset_content_type: application/java-archive | |
- name: Upload binaries | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/jmx-dump | |
asset_name: jmx-dump | |
asset_content_type: application/octet-stream |