change tag and release libraries #4
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: CI/CD Pipeline | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: cli-utils on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
native-image-job-reports: 'true' | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: nativeCompile | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cli-utils-${{ matrix.os }} | |
path: ${{ github.workspace }}/**/build/native/nativeCompile/* | |
if-no-files-found: error | |
tag: | |
name: Create tag and Release | |
needs: [build] | |
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v3 | |
with: | |
path: cli-utils/bin | |
- name: Display structure of downloaded files | |
run: ls -al | |
working-directory: cli-utils/bin | |
- name: Publish Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: cli-utils/bin/* | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
# - name: Bump version and push tag | |
# uses: anothrNick/[email protected] # Don't use @master or @v1 unless you're happy to test the latest version | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token | |
# WITH_V: true | |
# DEFAULT_BUMP: patch | |
# publish: | |
# needs: [tag] | |
# name: publish release | |
# runs-on: ubuntu-latest | |
# permissions: | |
# contents: write | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# | |
# - name: Publish release | |
# uses: ghalactic/github-release-from-tag@v5 | |
# with: | |
# generateReleaseNotes: "true" | |
# assets: | | |
# - path: cli-utils/bin/* | |
# optional: true |